osx - Executing shell commands with NSTask - Objective-C Cocoa -


i have been searching days , hours this, have seen lot of examples of this, cannot figure out how nstask works, let's wanted execute command killall dock or defaults write com.apple.finder appleshowallfiles yes that, how go doing this.

i know how execute external shell script (sh) need more sophisticated , use nstask instead.

thanks help!!

you like:

nstask *task = [[nstask alloc] init]; [task setlaunchpath:@"/bin/bash"]; [task setarguments:@[ @"-c", @"/usr/bin/killall dock" ]]; [task launch]; 

exactly launch path , arguments provide dictated command want run , parameters.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -