Re: NSTask: how to launch a binary as if I launched it via terminal?
Re: NSTask: how to launch a binary as if I launched it via terminal?
- Subject: Re: NSTask: how to launch a binary as if I launched it via terminal?
- From: Fritz Anderson <email@hidden>
- Date: Mon, 14 Apr 2014 10:23:51 -0500
On 14 Apr 2014, at 10:08 AM, Colas B <email@hidden> wrote:
> OK.
>
> But without the simple quotes, it also fails.
>
> With the quotes, the error is
> /bin/bash: pico /Users/colas/myfile.txt: No such file or directory
> Without the quotes, the error is
> Error opening terminal: unknown.
>
> Thanks!
> Le Lundi 14 avril 2014 16h19, Jerry Krinock <email@hidden> a écrit :
>
> From documentation of -[NSTask setArguments:] :
>
> "The strings in arguments do not undergo shell expansion, so you do not need to do special quoting”
>
> I don’t know what they mean by “special”, but anyhow, the ‘ ' you put around your last argument will be passed to your tool and cause it to fail.
> _______________________________________________
Try putting
/usr/bin/pico /Users/colas/myfile.txt
into separate items in the argument NSArray. I find the man page ambiguous, and I lack direct experience, but that may be what bash expects.
I can’t guarantee that this will solve the larger problem of whether the effect would be to launch Terminal.app and execute the command, but it’s worth trying.
— F
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden