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
Objective c: How to know the progress of formatting USB drive in using NSTask
I use NSTask to execute format USB drive from NTFS to FAT32. It works well, but I would like to know the progress when it starts to format.
Here is my code:
NSTask *task = [NSTask new];
[task setLaunchPath:@"/usr/bin/env"];
[task…

YU FENG
- 888
- 1
- 12
- 29
1
vote
0 answers
What's the point in using processes instead of threads?
Today I have a theoretical question for you guys.
I just joined my first larger software project at my company.
For some tasks such as copying files with some additional verification the company writes command line tools and they're calling them…

guitarflow
- 2,930
- 25
- 38
1
vote
0 answers
Separate processes that communicate via a NSpipe
I need to realize a communication between two application using NSPipe channels.A NSPipe has to write data and the other has to read the data (Bi-directional) that will communicate between separate process in two different applications.
For example…

vadivelu
- 508
- 10
- 26
1
vote
3 answers
NSTask Application loses focus
I'm using NSTask to launch an external app. But at this time, my app looses the focus. I don't want this. The other app just writes some infos in a file and my app reads and displays those infos. Is it possible, to start the NSTask app in the…

Lupurus
- 3,618
- 2
- 29
- 59
1
vote
1 answer
Code to use NSTask with ps to verify a process is running
I am having endless problems checking to see if the screen saver is running. If I use an NSTask with ps, it crashes or hangs on a lot of users. If I use notifications it seems to be spotty for others.
Any ideas as to why this NSTask is flakey? (Yes,…

JeremyLaurenson
- 979
- 2
- 11
- 23
1
vote
1 answer
How to read and write to NSTask
I have it working. However, initially it appears to be waiting for input. How can I read what was output before it stops and is waiting for input?
task starts
stdout should post data for "sftp> " but nothing happens, its waiting for input
If I write…

joels
- 7,249
- 11
- 53
- 94
1
vote
1 answer
Display output from nstask error
Ok so I'm trying to make an app that is basically a GUI for a script the part I can't get to work correctly is displaying the output of the script at first I had it so it should me everything after task had completed which needless to say is no…

user1972988
- 11
- 1
1
vote
2 answers
How to run find cmd with NSTask
I'm trying to get the following find command to work via NSTask:
find /Users/user/projects ! -path '*.git*' -ctime -1
However I am having trouble to get the ignore path part to work. In terminal it works fine. I get the modified files of the last…

Tycho Pandelaar
- 7,367
- 8
- 44
- 70
1
vote
0 answers
Terminating NSTask with NSFileHandle set for standard output
I have a batch of code that creates and runs an NSTask instance. Before running I set, for the standard output of the task, a NSFileHandle witch writes directly to a file I have created.
Sometimes the NSTask is terminated by code (by sending the…

Alex
- 5,009
- 3
- 39
- 73
1
vote
4 answers
Using NSTask: app freezing after returning output
Hi I have the following code:
- (IBAction)runTask:(id)sender {
NSTask *proc;
NSPipe *output;
NSData *data;
NSString *buffer;
proc = [[NSTask alloc] init];
output = [[NSPipe alloc] init];
[proc…

indragie
- 18,002
- 16
- 95
- 164
1
vote
1 answer
How to create a new Database by SQLite programmatically in Cocoa for OSX?
In a program , I need to let user to save data to a SQLite database ( a "Save as " Option ).
I did it by using NSTask for sending a command like: "sqlite3 ./mydatbase.db" as a Terminal command . It works fine on my own Mac, but not on others'…

Aug
- 595
- 9
- 22
1
vote
1 answer
Objective-C, NSTask grep string matches, but doesn't?
I've got an NSTask that uses a piped grep command; The output matches, and grep comes back with a match to my input string — although when comparing it back to the original string it doesn't match somehow. I'm probably not comparing the returned…

Joe Habadas
- 628
- 8
- 21
1
vote
2 answers
NSPipe - How to convert returned data to NSArray
My application uses NSTask to start a Python script, then the script returns an array via NSPipe. I read the data, stick it in a string, and display it:
NSMutableData *data = [[NSMutableData alloc] init];
NSData *readData;
while ((readData =…

janeh
- 3,734
- 7
- 26
- 43
1
vote
1 answer
Can someone help me spot a leak in this NSPipe/NSFileHandle code?
So I'm having this issue where once this NSFileHandle/NSPipe gets triggered... my CPU use and memory start going crazy. Problem is I'm finding it hard to find this leak. Any advice or help is appreciated. Cheers.
.h
NSTask *task;
NSPipe…

crewshin
- 765
- 9
- 22
1
vote
0 answers
Command line tool calling with root privilege on iOS device
I need something to run in my jailbreaked iPhone, "ifconfig en0 down", for example, which need to be ran with root privilege.
Although my application was installed with cydia and run under root permission, I dont have any way to call a command line…

Joker Bean..
- 13
- 4