Questions tagged [nstask]

NSTask Class on OS X API , lets you run another program as a subprocess and monitor that program’s execution

459 questions
0
votes
1 answer

osx application which has a button that sets the user's background as their screensaver

im making an osx application which has a button that sets the user's background as their screensaver. here's my code: -(IBAction)startSaver:(id)sender { NSTask *task; task = [[NSTask alloc] init]; [task setLaunchPath:…
0
votes
3 answers

Using NSTask to launch shell script that launches Node.JS

I have a cocoa app and I want to launch a shell script that launches Node.js. I figured I would do that with NSTask NSTask *task = [[NSTask alloc] init]; [task setLaunchPath:@"/bin/bash/start.sh"]; [task setArguments:[NSArray…
Mina Dawoud
  • 408
  • 8
  • 22
0
votes
1 answer

NSTask: why program is blocking when read from NSPipe?

I use the NSTask to run shell command and output the data via NSPipe. At first, I using bellow method to read output data, it is no any problem. - (void)outputAvailable:(NSNotification *)aNotification { NSString *newOutput; NSMutableData…
Gate Luma
  • 195
  • 1
  • 2
  • 10
0
votes
1 answer

How to control terminal by NSTask?

My source code is below: int main(int argc, const char * argv[]) { char str[80]; memset(str, 0x00, 80); sprintf(str, "%s %s", "open -a","terminal.app"); NSString *cmdstr = [NSString stringWithUTF8String:str]; NSTask *task =…
차지원
  • 1
  • 1
0
votes
2 answers

Show, activate and stop indetermined progress indicator

I'm having some issues with showing a progress indicator whenever a button is clicked, and then stop and hide the indicator when a NSTask is completed. This should be the timeline: 1- Button clicked 2- shows progress indicator (from originally…
Rstew
  • 585
  • 2
  • 9
  • 21
0
votes
1 answer

Sending EOF to NSTask via NSPipe or NSFileHandle

I have an NSTask which processes arguments passed from stdin. The arguments are passed via NSFileHandle. It's working fine, but our command line tool reads input from stdin until it receives the EOF symbol (by pressing Ctrl+C). I don't think I can…
guitarflow
  • 2,930
  • 25
  • 38
0
votes
2 answers

Using NSTask with an NSPipe and a Perl script that spawns another process

I am running a Perl script within an NSTask object with it's output going into an NSPipe. I am using notifications to receive it's output periodically and update the GUI. The Perl script actually spawns other processes whose output doesn't seem to…
Struddie
  • 140
  • 5
0
votes
1 answer

Objective c: How to change option in "Security & Privacy" via terminal

I want to change the selection of "Allow applications downloaded from :" to anywhere via terminal. Thanks!!
YU FENG
  • 888
  • 1
  • 12
  • 29
0
votes
1 answer

Forcing Python to run in 64 mode from a NSTask subprocess

What is a method that forces python to run in 64 mode from a NSTask? Update: As per Ned's suggestion I tried referencing Python2.7 directly with objective c and that worked. Changed @"/usr/bin/python" to @"/usr/bin/python2.7". The new code is at the…
Keith John Hutchison
  • 4,955
  • 11
  • 46
  • 64
0
votes
2 answers

NSTask hangs on readDataToEndOfFile

Trying to read the data returned from an NSTask causes a hang that never returns. I've verified my script being run does in fact return data to both stdout and stderr. It's a simple two line shell script that sends one line to stdout and the other…
Gargoyle
  • 9,590
  • 16
  • 80
  • 145
0
votes
2 answers

How to grep return result as the matching term

I would like to return only the first instance (case-insensitive) of the term I used to search (if there's a match), how would I do this? example: $ grep "exactly-this" Binary file /Path/To/Some/Files/file.txt matches I would like to return the…
T. Rex
  • 1
0
votes
1 answer

Objective c: Error when using NSTask to unmount a USB drive

Here is the problem, when I use the NSTask to unmount the current USB drive it will give me following error: 2013-06-03 09:39:41.096 NAME[1028:303] in moving file view controller dyld: DYLD_ environment variables being ignored because main…
YU FENG
  • 888
  • 1
  • 12
  • 29
0
votes
1 answer

NSTask File Path Converting Into ShellPath?

I have a Mac (not iOS) application. I want to run a shell command 'find' after the user selects a folder with NSOpenPanel. The following is what I have. NSString *path = [url path]; NSString *folderName = [path lastPathComponent]; NSTask *task =…
El Tomato
  • 6,479
  • 6
  • 46
  • 75
0
votes
1 answer

xcode using an included binary to communicate with /dev/cu.*

I have an app that creates a friendly GUI for several command line programs, some c some python (py2app). It uses NSTask but in one instance needs to communicate with a serial usb device on /dev/cu.* and this fails with NSTask. What is the best way…
Jay
  • 902
  • 2
  • 12
  • 27
0
votes
2 answers

NSTask plutil unrecognized option

I'm trying to use NSTask to convert a binary plist to xml, although run into an error that I don't quite understand. If I take the command NSTask fails on and copy it to the command line it works just fine. Hopefully someone can tell me what is…