• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTask not using arguments?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask not using arguments?


  • Subject: Re: NSTask not using arguments?
  • From: Robert Martin <email@hidden>
  • Date: Thu, 24 Feb 2005 07:47:12 -0500

NSTask arguments are specific to a single task, not a pipeline. Check out NSPipe and NSFileHandle to handle the redirection. There's plenty of documentation out there on Google - here's an overview: http://cocoadevcentral.com/articles/000025.php

HTH Rob


On Feb 24, 2005, at 7:27 AM, email@hidden wrote:

I have an NSTask set up to take 4 arguments, the first a switch "-b", the second is an absolute path to some files, the third is the output redirection operator ">" and the last is another absolute path with a desired filename. The task is supposed to take the files in the first directory and redirect the output to a checksum file described in the second path.

Let me first say that I went into Terminal to use the same exact UNIX app, using the same exact values as my application set in the standard arguments array, and it worked fine. It created the desired checksum file.

But when I run my app, it's almost acting like it's not accepting or not using the second, third, and fourth arguments. After "processing", I get the following errors:

/Users/james/DevBox/AudioConverter/build/AudioConverter.app/Contents/ Resources/Binaries/bin/md5sum: /Users/james/Desktop/test/*.shn: No such file or directory.

md5sum: >: No such file or directory
md5sum: /Users/james/Desktop/md5sum.md5: No such file or directory.

Now, the first pathname is in an NSString variable md5Path. The output redirection operator is simply @">", and the last pathname is in an NSString md5File. My arguments array looks like this:

NSArray* arguments = [NSArray arrayWithObjects:@"-b", md5Path, @">", md5File, nil];

I set the tasks arguments correctly, but when the task is launched, I get the above errors. The paths are being generated by the user choosing files and directories in Open/Save panels, and I know these paths to be correct. And like I said, I've used the same exact values in these variables in the command line program in Terminal, and it executes just fine. But when run from an NSTask, it just doesn't work. Can anyone tell me what I'm missing? Thanks.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >NSTask not using arguments? (From: <email@hidden>)

  • Prev by Date: NSTask not using arguments?
  • Next by Date: Binding name must be same as ivar name?
  • Previous by thread: NSTask not using arguments?
  • Next by thread: Re: NSTask not using arguments?
  • Index(es):
    • Date
    • Thread