NSTask is Weird
NSTask is Weird
- Subject: NSTask is Weird
- From: "J. Todd Slack" <email@hidden>
- Date: Wed, 10 Sep 2008 20:24:40 -0700
Hi All,
NSTask seems weird to me.
I am trying to call a command-line app with arguments.
When I execute in a Terminal it works, but from my application is fails.
Here it the command I am executing:
/usr/local/bin/pymp3cut --segment "/Users/slack/Library/Application
Support/Ring-Maker/tmp/amber",00:00:11,00:00:36 "/Users/slack/Music/
iTunes/iTunes Music/311/Unknown Album/01 Amber.mp3"
I get this from the debugger console:
2008-09-10 20:18:20.242 Ring-Maker[4174:10b] An exception was thrown
during execution of an NSScriptCommand...
2008-09-10 20:18:20.242 Ring-Maker[4174:10b] launch path not accessible
Here is what I am doing:
NSString *strArguments = [NSString stringWithFormat: @"%@%@%@%@%@%@%@%@
%@%@%@%@%@",
@"--segment",
@" ",
@"\"",
ringToneNameMP3Path,
@"\"",
@",",
startStr,
@",",
endStr,
@" ",
@"\"",
path,
@"\""
];
/* take all the pieces and build up command for NSTask */
arguments = [NSArray arrayWithObjects: strArguments, nil];
[task setLaunchPath: @"/usr/local/bin/pymp3cut"];
[task setArguments: arguments];
[task setStandardOutput: pipe];
[task launch];
In the debugger it shows:
/usr/local/bin/pymp3cut --segment "/Users/slack/Library/Application
Support/Ring-Maker/tmp/amber",00:00:11,00:00:36 "/Users/slack/Music/
iTunes/iTunes Music/311/Unknown Album/01 Amber.mp3"
Which looks right.
Any thoughts?
-Jason
_______________________________________________
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