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
0 answers

Running shell script using NSTask in Mac OS

I have written a shell script and the purpose of that script is to capture packet using TCPDUMP and write that capture packet to .pcap file Script is: TCPDumpScript.sh echo "peter" | sudo -S tcpdump -i rv0 -n -s 0 -w dumpfile.pcap tcp I am launching…
peterDriscoll
  • 377
  • 4
  • 8
0
votes
1 answer

Use NSTask to ssh into another computer

Is there a way I can use NSTask to ssh into another computer (in this case a chumby) and run commands on that device? I also have a password on it.
Matt S.
  • 13,305
  • 15
  • 73
  • 129
0
votes
1 answer

Cannot pass special characters to an NSTask

In Cocoa, I would like to pass a string containing special characters to an NSTask as arguments, however the task does not get the proper string. NSString *city=@"Zürich"; // This is the string with a special character [arguments addObject:[NSString…
0
votes
1 answer

Strange output from LESS when using with NSTask

I'm trying to use LESS with NSTask. It basically works but the output is sometimes quite strange. Example: [31mParseError: Unrecognised input[39m[31m in [39m/Volumes/Macintosh HD/Users/x/Sites/y/css/style.less[90m on line 4, column 2:[39m [90m3 …
idmean
  • 14,540
  • 9
  • 54
  • 83
0
votes
2 answers

NSTask: program launching another program, how to do?

I want to do with an NSTask what I am able to do in the terminal via $ myprogram myfile.ext I know that myprogram (I don't have any control on this program) launches another program myauxprogram. Furthermore, the path to myprogram is path1 and the…
Colas
  • 3,473
  • 4
  • 29
  • 68
0
votes
2 answers

Execution stopped at readDataToEndOfFile method in iOS

App execution stopped/hang after "readDataToEndOfFile" method executes. Please find the below code, how to fix this issue - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a…
Sudheer Kumar Palchuri
  • 2,919
  • 1
  • 28
  • 38
0
votes
1 answer

NSTask for SSH using PTY

I'm trying to write an app that will programmatically log in to a remote device using SSH much like an expect script (I know I can use expect but I would like to do this in Obj-c). I have researched a lot on this and know that I need to use a pty. …
0
votes
1 answer

Comparing 2 strings in Objective-C

I have a NSTask of which the output is stored in an NSData object. From this I get a string via NSString *outputString = [[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding]; Now I can NSLog this string and then compare it via…
DaPhil
  • 1,509
  • 4
  • 25
  • 47
0
votes
2 answers

Cannot Pass Argument to /bin/sh

I'm writing a command line helper for one of my cocoa apps. This helper tool is supposed to execute an instance of shell ( /bin/sh ) using NSTask. As you all know it's possible to execute sh taking advantage of -c, you can pass one or more command…
Sepehrom
  • 1,335
  • 2
  • 16
  • 33
0
votes
2 answers

Where are the osx commands stored?

I'm writing a mac app (osx 10.9) that accesses the terminal commands using NSTask and I wanted to run some of the commands from my app. Where are the terminal commands (gcc, mkdir,git) stored?
Coder404
  • 742
  • 2
  • 7
  • 21
0
votes
1 answer

NSTask /usr/bin/compress, loop writes standardInput, reads standardOutput by blocking on availableData

I'm trying to compress a file using /usr/bin/compress, launched with no file name so that it takes data from stdin and writes compressed data to stdout. I create the task with pipes for standardInput, Output & Error. In a loop, I read a block of…
0
votes
3 answers

Relaunching application via NSTask ignores LSMinimumSystemVersionByArchitecture

I'm running into an issue with relaunching my application on 10.5. In my Info.plist I have LSMinimumSystemVersionByArchitecture set so that the application will run in 64-bit for x86_64 and 32-bit on i386, ppc, and ppc64. I have a preference in the…
Justin Williams
  • 703
  • 1
  • 9
  • 26
0
votes
1 answer

Results of NSTask in NSTextView

Thanks for the help. My code below works, returning results in the Console. I want to display the same results in a textView. Can't get it to work. Can anyone explain what I need to do? Thanks. -(IBAction)activateTask:(id)sender { NSURL *fileURL =…
Paul
  • 189
  • 10
0
votes
2 answers

execute lame with NSTask but No Output

I'm new to Objective-C. Currently I'm trying to execute lame with NSTask. The following code seems to be working because Xcode's output space shows me lame's standardoutput i.e. shows same as lame's output on Terminal. But I can't get any output…
xanadu6291
  • 931
  • 10
  • 20
0
votes
0 answers

Cocoa, launch a package from my application

I would like to launch a packages (.pkg extensions) when I press a "Start" button on my application. The packages in question is in my Resource folder. The first make some preliminary tasks, another at the end of the process. They do not have the…
Mike97
  • 596
  • 5
  • 20