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
0
votes
1 answer
echo Does Not Work with NSTask and readInBackgroundAndNotify
I have the following Obj-C code and its log output. Can anyone tell me why I'm not getting any output from the NSFileHandle?
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[self…

Shun Y.
- 103
- 1
- 6
0
votes
1 answer
NSTask not working as expected / hoped for
get_iplayer allows user to download files from the BBC iPlayer service. It is awesome, they both are.
I'm attempting to run a get_iplayer command from within Xcode using NSTask:
NSTask *task = [[NSTask alloc] init];
[task…

Return_Of_The_Archons
- 1,731
- 3
- 20
- 26
0
votes
1 answer
Unable to get intermediate output from NSTask's stdout?
I have written an NSTask async exec method for a simple python script.
When then python script just prints to stdout, all is fine.
When there is a raw_input in there (expecting input from the user), it sure gets the input fine, but it does NOT print…

Dr.Kameleon
- 22,532
- 20
- 115
- 223
0
votes
2 answers
security find-generic-password command for safari returning some garbage value
I want to find the Safari Extensions List password from the keychain. I am doing it through NSTask now, As soon as we launch the task, it is printing some password. But When I store the password in some NSString using,
NSString * password =…

user3328076
- 31
- 5
0
votes
0 answers
Run vim using NSTask
I'm writing console program. I want to launch vim from that program, wait until user exits it and continue execution.
let editorTask = NSTask()
editorTask.currentDirectoryPath = "/Users/vbezhenar/Documents"
editorTask.launchPath =…

vbezhenar
- 11,148
- 9
- 49
- 63
0
votes
0 answers
Start Activity Indicator View before launching NSTask Objective-c ios
In my app, I've several buttons that, when pressed, launch an NSTask. It works well but I would like to inform the user when this task begin and when it finish by showing an Activity Indicator View (the little gray wheel).
Does anybody can give me…

Synny
- 542
- 1
- 4
- 18
0
votes
1 answer
Launch command line in Objective C
I would like to exec this command line in objective-C in order to launch an app from another :
open -n myApp.app --args arg1 arg2
I managed to do it without arguments with :
NSFileManager *fileMgr = [NSFileManager defaultManager];
NSString…

SteveTJS
- 635
- 17
- 32
0
votes
1 answer
Cannot read stdout from an NSTask in release mode
I'm reading the stdout of an NSTask like so:
NSPipe *outputpipe = [[NSPipe alloc] init];
NSFileHandle *output = [outputpipe fileHandleForReading];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedOutputFromAlgo:)…

Artelis
- 159
- 1
- 11
0
votes
1 answer
Multiple terminal commands using NSTask at once
I need to run the following command from an OSX app:
dscl . -read /Users/user JPEGPhoto | tail -1 | xxd -r -p > /Users/user/Desktop/user.jpg
Ive tried several things such as:
func runScript(launchPath:String, scriptName:String) {
let task =…

Lee Andrew
- 798
- 7
- 28
0
votes
2 answers
Can't find leak in my code
I've been spending the last few hours trying to find the memory leak in my code. Here it is:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
expression = [expression stringByTrimmingCharactersInSet:
[NSCharacterSet…

ryyst
- 9,563
- 18
- 70
- 97
0
votes
0 answers
Running script from terminal works, but does not work when invoked from Mac app
I have a script file with the following code:
if [ ! -d ~/Remote/username/projects ]
then
sshfs -C -p 22 user@remotecomputer.com:/home/username ~/Remote/username
fi
and when I run it from the terminal, it works, however when I…

codenamepenryn
- 451
- 1
- 7
- 18
0
votes
1 answer
NSTask string encoding problem
In my program, I'm grep-ing via NSTask. For some reason, sometimes I would get no results (even though the code was apparently the same as the command run from the CLI which worked just fine), so I checked through my code and found, in Apple's…

ryyst
- 9,563
- 18
- 70
- 97
0
votes
1 answer
How to open a document using an application launched via NSTask?
I've grown tired of the built-in open Mac OS X command, mostly because it runs programs with your actual user ID instead of the effective user ID; this results in the fact sudo open Foo opens Foo with its associated application with your account…

zneak
- 134,922
- 42
- 253
- 328
0
votes
1 answer
Issue getting NSTask and SMJobSubmit to run properly
As far as I can tell, this code should be running my script with elevated permission, but the NSTask doesn't seem to ever actually launch. I'm relatively new to Objective-C and Cocoa so I'm probably missing something simple here but either way I'm…

Sam W
- 599
- 2
- 16
0
votes
1 answer
NSTask a shell script with root access without asking for password
I have a script that I am running from within a Cocoa application via NSTask. The script is using rsync to backup everything in the /Users folder to a server. The problem that I am running into is that when you run the program as user "a" the script…

Sam W
- 599
- 2
- 16