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
'NSInternalInconsistencyException', reason: 'Couldn't posix_spawn: error 13' Swift
I'm making an iOS app for jailbroken devices running iOS 12 with Swift.
Recently I made a question, which I answered myself, in which I asked for a way to run command line tasks with Swift in iOS.
But as you can see, I'm not done yet as I'm able to…

amodrono
- 1,900
- 4
- 24
- 45
1
vote
2 answers
Objective-C, NSTask Buffer Limitation
I'm using NSTask to run an external utility which returns a long string of data. The problem is that when the returned string exceeds a large amount of data (around 32759 chars) it becomes null or truncates the returned string. How do I return the…

Joe Habadas
- 628
- 8
- 21
1
vote
1 answer
Jailbroken iOS: NSTaskDidTerminateNotification fails to launch selector
I seem to have the same problem as here: NSTask waitUntilExit hanging app on jailbroken iOS
Here's what I've got via NSNotification (like above), yet the taskEnded: alert(s) aren't coming up. The script is definitely run, as I can see it in the…

Kaikz
- 171
- 1
- 1
- 9
1
vote
1 answer
-[NSConcreteTask waitUntilExit] results in KERN_PROTECTION_FAILURE
I'm getting an error like the following (censored and trimmed to protect proprietary info):
Process: MyExecutable [7150]
Path: /Applications/Company Name/Parent App.app/Contents/PlugIns/MyExecutable
Identifier: …

Ky -
- 30,724
- 51
- 192
- 308
1
vote
4 answers
Launch an NSTask and bring it to front
I'm trying to launch another application using NSTask
NSArray* argArray = [NSArray arrayWithObjects:fileName, nil];
NSTask* task = [NSTask launchedTaskWithLaunchPath:appName arguments:argArray];
while this works the main gui window doesn't come to…

user549164
- 173
- 2
- 13
1
vote
1 answer
Cocoa question - NSTask isn't working
NSTask isn't working; I think it has to do with the arguments. Here is my code:
- (IBAction)downloadFile:(id)sender {
// allocate our stuff :D
progressIndication = [[NSProgressIndicator alloc] init];
NSTask *downloader = [[NSTask…

walri
- 11
- 1
1
vote
0 answers
Swift NSTask not executing some Terminal commands
I am using a Swift playground to experiment with executing a terminal command to launch an application. In the code that follows, task,task1 and task2 work, so I know that pdflatex (my application) and its target (test.tex) exist and are…

Black Feather
- 31
- 4
1
vote
1 answer
Use non-system ruby to execute ruby scripts within macOS App
I'm building an macOS app which needs to execute a framework written in ruby. Currently with macOS High Sierra 10.13.x the system ruby version is only 2.3.3. I'm using brew / rvm (it depends) to install up to date versions.
When trying to run…

sn3ek
- 1,929
- 3
- 22
- 32
1
vote
3 answers
NSTask Output Formatting
I'm using an NSTask to grab the output from /usr/bin/man. I'm getting the output but without formatting (bold, underline). Something that should appear like this:
Bold text with underline
(note the italic text is actually underlined, there's just no…

jstm88
- 3,335
- 4
- 38
- 55
1
vote
2 answers
NSTask Does Not Terminate
I'm trying to use NSTask to run the UNIX 'apropos' command. Here's my code:
NSTask *apropos = [[NSTask alloc] init];
NSPipe *pipe = [[NSPipe alloc] init];
[apropos setLaunchPath:@"/usr/bin/apropos"];
[apropos setArguments:[NSArray…

jstm88
- 3,335
- 4
- 38
- 55
1
vote
2 answers
NSTask Launch causing crash
I have an application that can import an XML file through this terminal command :
open /path/to/main\ app.app --args myXML.xml
This works great with no issues. And i have used Applescript to launch this command through shell and it works just as…

tripskeet
- 186
- 2
- 12
1
vote
2 answers
Result of a bash command executed through NSTask
I have this example of using NSTask in Objective-C
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/bin/bash"];
[task setArguments:@[ @"-c", @"cp /Directory/file /users/user_name/Desktop" ]];
[task launch];
I want to know if the [task…

Programmer
- 103
- 1
- 9
1
vote
2 answers
NSTask problem with 'cat' command
I try concatenating files using the cat command.
When I use this in the terminal, everything works fine :
cat /Users/Home/Desktop/test.mp3* > test.mp3
Trying to reproduce this using an NSTask, gives me the error below :
Code :
NSArray *Args =…

Bruno
- 87
- 1
- 9
1
vote
1 answer
Unable to use NSTask to write using Sandbox
I am having a hard time debugging an issue with NSTask.
I start NSTask using the following:
NSTask *convTask = [[NSTask alloc] init];
[convTask setLaunchPath:[[NSBundle mainBundle] executablePath]];
[convTask setArguments: [NSArray arrayWithObjects:…

Carl Henry
- 13
- 2
1
vote
2 answers
"Launch path not accessible" using NSTask to create Git commit
I am trying to use NSTask to create a Git commit and to add a message to that commit.
This is the code I have tried.
NSString *projectPath = @"file:///Users/MYNAME/Desktop/MYPROJECT/";
//stage files
NSPipe *pipe = [NSPipe pipe];
NSTask *task =…

SimpleApp
- 506
- 4
- 17