NSTask Class on OS X API , lets you run another program as a subprocess and monitor that program’s execution
Questions tagged [nstask]
459 questions
1
vote
1 answer
Clang NSTask with streams
Never-mind all the "why?","useless?", and "don't bother" comments. I want to compile a program inside another program using clang. I can create the NSTask and set up the arguments and it will work if the file exists, (ie. no stream), and writes to a…

utahwithak
- 6,235
- 2
- 40
- 62
1
vote
1 answer
RSYNC Directories vs Files
I'm trying to put together a little RSync program for the hell of it, and I managed to get it to work with the code below. The only problem is that it only Rsyncs single files and not directories. If you run rsync through the terminal command it can…

crashprophet
- 327
- 1
- 4
- 13
1
vote
1 answer
Receiving data AFTER task termination?
I'm using NSTask and NSPipe to execute a command and asynchronously get its output.
The code I'm using is almost 100% the same as in my question, here (with the fixes included).
However, while I'm testing it, I noticed that some times, the…

Dr.Kameleon
- 22,532
- 20
- 115
- 223
0
votes
1 answer
How to run unix utility with NSTask and input data?
I run zip utility from my app to create archive. Code similar to the following:
NSString *toolPath = @"/usr/bin/zip";
NSTask *task = [[[NSTask alloc] init] autorelease];
[task setLaunchPath:toolPath];
[task setArguments:arguments];
[task launch];
,…

ifau
- 2,100
- 1
- 21
- 29
0
votes
1 answer
NSTask to retrieve the output of an external command stopped woking on Lion
The following code was working fine until I upgraded to OSX Lion. It called an external command and saved the output into a NSString.
I have no idea why it stopped working. Any ideas?
-(NSString *) rawResponse{
NSTask *task = [[NSTask alloc]…

cfischer
- 24,452
- 37
- 131
- 214
0
votes
2 answers
Disabling Mission Control, Spaces, Dashboard and any other external process
I was wondering if it was possible to (for a short period of time) disable and re-enable external processes to an application like Mission Control, Spaces, Expose, Dashboard, etc... within an application, while still allowing the user to use my…

GravityScore
- 385
- 1
- 3
- 13
0
votes
1 answer
NSTask 'launch path not accessible'
My application requires a dylib file to be in /usr/lib/. If it is not there, the application copies the dylib to /usr/lib/ from the application resources directory. To do this, I use a helper tool, which calls /usr/bin/sudo.
Although this…

JimmyB
- 326
- 3
- 12
0
votes
1 answer
How to Check FTP Connection via NSTask?
I want to write a cocoa application that checks if my ftp server is still up and running.
So far I learned that CFFTP could be used but this is not object oriented code so a no go for me. Also some people recommend ConnectionKit but that won't build…

ChristophMa
- 129
- 2
- 2
- 6
0
votes
2 answers
Cocoa - Add some bytes at the end of a file
I'm developing a Cocoa app that has to execute some terminal commands. One of these looks like:
printf "\xc5\x20\x00\x00" >> aFile.txt
I tried with NSTask (but I'm not sure how to split the arguments):
NSTask *task = [[NSTask alloc] init];
[task…

Oneiros
- 4,328
- 6
- 40
- 69
0
votes
1 answer
How to execute shell-command "ping" and get result into string in Objective-C/Cocoa?
I tried this code
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/usr/bin/ping"];
NSArray *arguments;
arguments = [NSArray arrayWithObjects: @"-c", @"3",@"stackoverfow.com", nil];
[task setArguments: arguments];
NSPipe…

Alex Zheludov
- 171
- 5
- 17
0
votes
0 answers
Launching executable in app with NSTask launches wrong task
I have a macOS app, "My prog.app", with several executables. The app is installed to "/Applications/My prog.app" and all executables are located in "/Applications/My prog.app/Contents/MacOS/". The "Contents/MacOS/" folder already contains some…

Ole Bjørn Setnes
- 748
- 5
- 20
0
votes
0 answers
getchar() from child process is not working
I have two mac applications X and Y. X is launching Y as child process using NSTask. And Y is reading input from user using getchar(). When running process X from Terminal. The child process X is hanging on getchar(). Looks like stdin is not working…
0
votes
1 answer
Executing shell commands for iOS apps
How do I execute shell commands for iOS app in Xcode(it does not support NSTask.h as the app is sandboxed)?

Ayushi Paul
- 1
- 1
0
votes
0 answers
Launch path is not accessible when trying to run NSTask within XCUITest testing iOS app
When I try to run my .jar file that is located in the project's resources folder I get an exception that says "Launch path is not accessible."
I have created a bridge Objective-C file so swift will have access to NSTask interface.
My code source…

Temka Vibornov
- 1
- 2
0
votes
1 answer
launchApplicationAtURL: crash
crash message:
Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff203c9f2a fileport_makeport + 10
1 libxpc.dylib 0x00007fff20147373 _xpc_fileport_makeport + 9
2 …

YanQing
- 61
- 1
- 3