• 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: Client ssh
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Client ssh


  • Subject: Re: Client ssh
  • From: Dominic Blais <email@hidden>
  • Date: Wed, 31 May 2006 09:33:36 -0700


On May 31, 2006, at 9:05 AM, Shawn Erickson wrote:

On 5/31/06, Dominic Blais <email@hidden> wrote:

[[NSTask launchedTaskWithLaunchPath:@"/usr/bin/ssh" arguments:
[NSArray arrayWithObjects: @"www.somesite.net", @"ls", nil]]
waitUntilExit];

You likely already know but... using waitUntilExit in that way can get you into a deadlock. You need to drain the stdio related pipes of the launched process or it can block on you waiting for room in the pipe (it will never exit so you will stay in waitUntilExit).

-Shawn

Thanks, Shawn. I didn't know that, but I'm not able to reproduce it either. While waitUntilExit most definitely can block indefinitely like this:
[[NSTask launchedTaskWithLaunchPath:@"/usr/bin/passwd" arguments: [NSArray array]] waitUntilExit];


However, while any explicit wait for another program should likely have a watchdog timer, I didn't see any kind of dead lock occurring when reading a large text file with cat:
[[NSTask launchedTaskWithLaunchPath:@"/bin/cat" arguments: [NSArray arrayWithObjects:@"/Users/dominic/test.txt", nil]] waitUntilExit];


NSTask can have the pipes redirected (similarly to popen) and that could cause the dead lock you're describing, but the default case inherits the io pipes of the task's parent. Did I miss something in the docs?

_______________________________________________
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


  • Follow-Ups:
    • Re: Client ssh
      • From: "Shawn Erickson" <email@hidden>
References: 
 >Client ssh (From: Valerio Ferrucci <email@hidden>)
 >Re: Client ssh (From: Dominic Blais <email@hidden>)
 >Re: Client ssh (From: "Shawn Erickson" <email@hidden>)

  • Prev by Date: NSPasteboard discard type
  • Next by Date: Re: Many-to-many coredata fetch request
  • Previous by thread: Re: Client ssh
  • Next by thread: Re: Client ssh
  • Index(es):
    • Date
    • Thread