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
NSTask data split by newline \n
I'm new to objective-C, so please forgive me if I'm missing something. But we all have to start somewhere :)
I have a snippet of code I got from another open source project that executes a command and passes the result to another method. What I need…
user775171
0
votes
1 answer
NSTask real-time monitoring output
I can't seem to be able to monitor the output of my NSTask command. To my understanding, NSNotificationCenter must be used. The terminal command I am attempting to run downloads a file from my secured server using various encryption methods (it…

Darth Maul
- 84
- 8
0
votes
2 answers
Using awk with NSTask
How would I use this awk command:
awk 'NR>1{print $1}' string-to-modify
with NSTask? I already tried setting /usr/bin/awk as the launch path, 'NR>1{print $1}' as an argument, then the string to modify as another argument but all I get is…

indragie
- 18,002
- 16
- 95
- 164
0
votes
1 answer
Run user defined command with NSTask
I would like to execute a terminal command specified by the user. For example, the user might write killall "TextEdit" or say "Hello world!" in a text field, and I want to execute that command.
NSTask is the way to go, except I have two problems…

Alex
- 5,009
- 3
- 39
- 73
0
votes
1 answer
tops command giving error when executed through NSTask
I am trying to use below tops command through NSTask:
tops replace "__My_CompanyName__" with "XYZ" TryItOut.m
but it is always giving below error:
File replace "__My_CompanyName__" with "XYZ" does not exist
When executed through terminal it works…

Devarshi
- 16,440
- 13
- 72
- 125
0
votes
2 answers
Difference between NSThread and NSTask
This may sound like noobish question but I have tried researching these two classes and I am not 100% sure what their differences and specific purposes are. Also, is there some way I can retrieve a list of all the currently running processes much…

rolling_codes
- 15,174
- 22
- 76
- 112
0
votes
1 answer
NSTask, NSPipe - Can't concatenate the returned string
In my Mac OS app I have NSTask calling a Python script, which then returns "connected" via NSPipe. I then read the data in my Obj-C class, and put it in a string:
NSMutableData *data = [[NSMutableData alloc] init];
NSData *readData;
while…

janeh
- 3,734
- 7
- 26
- 43
0
votes
0 answers
ASIHTTPRequest and NSTask
I was trying out ASIHTTPRequest to make downloading files easier, but now I'm getting an error about the use of an undeclared identifier 'NSTask'.
I thought NSTask was only for Mac and not for iOS? Doesn't the framework check this?

woutr_be
- 9,532
- 24
- 79
- 129
0
votes
1 answer
Retrieve Trash size as an int in cocoa app
Is it possible for a cocoa app to retrieve the size of the trash as an int. Is NSTask the correct method to do this?
user1445205
0
votes
1 answer
NSTask crashes when used in function
In my program I currently use NSTask 5 times, and it all works very well, but I'm tired of having to repeat so much code when it's all so similar, so I tried putting it in a function. Unfortunately it results in a crash on the line: [task launch].…

Cristian
- 6,765
- 7
- 43
- 64
0
votes
1 answer
Objective-C, NSTask won't touch files
I have the following code (below) in my app, which simply tries to use NSTask to touch one file with the directory time/date stamp. It works just fine in an app which only accesses one directory all the time, however, it doesn't with another that…

Joe Habadas
- 628
- 8
- 21
0
votes
2 answers
NSTask in Objective-C
So I'm trying to run some terminal commands from my program, and I am getting some confusing errors.
Im a newer developer coming from Java, so I may be missing something.
Heres the code:
NSTask *task = [[NSTask alloc] init];
NSString *commitText =…
user1438586
0
votes
2 answers
Objective-C: Multiple Views and Data Coming From An NSTask
So, I managed to get NSTask to read asynchronously from a program, but I did it inside the class of a UIView in my storyboard. (Not an Obj-C expert)
My ideia is: I read the text from the program place it on a UITextView and then when there's more…

TCB13
- 3,067
- 2
- 39
- 68
0
votes
1 answer
Strange issue of output via NSPipe when execute shell command using NSTask
Here is my codes. When I set myCmd=@"cd /\nls -l\n" or myCmd=@"ls -l\n", it's no problem.
However, when I set myCmd=@"cd /\n", program is dead in the line if ((output =[[outPipe fileHandleForReading] availableData]) && [output length]) and there is…

Tom Jacky
- 203
- 1
- 7
- 20
0
votes
1 answer
Objective-c: How to use NSPipe output the illegal command echo in a NSTask?
I have code like following, it's ok, but I have 2 question about it.
1) If I assign some illegal para to sh, for example @"ls - l", then the outString is null. That is to say, it can not capture the error warning "ls: -: No such file or…

Tom Jacky
- 203
- 1
- 7
- 20