• 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: Submit background task
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Submit background task


  • Subject: Re: Submit background task
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Fri, 17 Jun 2005 01:09:47 +0200

At 16:24 Uhr +0200 16.06.2005, John Nairn wrote:
What is the best way (NSTask or other) to submit a background process that will continue running even if the submitting application quits? I tried an NSTask adding arguments ">", "output file name", and "&", to redirect to a file and run in background, but NSTask just passed the new arguments to the main task.

Of course. NSTask is simply a class to run a tool. It is not a shell. It doesn't parse the arguments in any way and doesn't do pipes. If you want to redirect, do so using NSPipe or an NSFileHandle and setStandardOut: or whatever the method in NSTask is called again.


However, I'm not sure, but NSTask may launch your NSTask as a subtask of your app, in which case it will be quit as soon as your app quits. The docs should say so, if not a short test will tell you (if you need to test it, file a bug against the docs, please, so that info gets added).

 Of course, there's always the lower-level BSD Unix system calls.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
       "The Witnesses of TeachText are everywhere..."
                   http://www.zathras.de
_______________________________________________
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: 
 >Submit background task (From: John Nairn <email@hidden>)

  • Prev by Date: Re: QT & Cocoa
  • Next by Date: Re: Very odd NSImage problem ...
  • Previous by thread: Submit background task
  • Next by thread: Re: Submit background task
  • Index(es):
    • Date
    • Thread