In objective-c I can do the following:
NSTask* foo = [NSTask alloc]init];
[foo setLaunchPath:@"/usr/bin/open"];
[foo setArguments:[NSArray arrayWithObjects:
@"/foo/foobar.app/foobarbinary,
nil]];
// Arguments to the command: the name of the
// Applications directory
[foo launch];
// Run the command
[foo release];
The problem is, if foobarbinary accepts command line arguments, how do I pass them in? :) If I add them to the NSArray, then the shell assumes they are an argument for "open". If I add it to the string, just after foobarbinary, (e.g.: @"foo/foobar.app/foobarbinary -someargument") , then "open" assumes that the name of the file is "foo/foobar.app/foobarbinary -someargument".
So how do I pass an argument to an argument? :S
EDIT. I tried using the --args command in the array. But it seems that foobarbinary doesn't receive the arguments I specify afar the --args. :S Anyone have an example I can look at?