I am trying to complete the openvpn task generated through NSTask.
My question is:
Should I send ctrl+ c(SIGINT) to the NSPipe input for my NSTask?
inputPipe = [NSPipe pipe];
taskInput = [inputPipe fileHandleForWriting];
NSString dataString = @"\cC";
[taskInput writeData:[dataString dataUsingEncoding: [NSString defaultCStringEncoding]]];
As an alternative, I was thinking about using kill (pid, SIGINT); but it would be much more complicated, since the process identifier should be determined using a workaround ([task processIdentifier] does not help here) - the initial NSTask calls:
/bin/bash -c sudo -S | mypassword ....
This is not good, I know, but it is called only once, and the sudo password has already been entered in this case.
source
share