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

Re: NSTask Question


  • Subject: Re: NSTask Question
  • From: Sherm Pendley <email@hidden>
  • Date: Tue, 22 Jun 2004 16:29:07 -0400

On Jun 22, 2004, at 3:50 PM, Glenn Zelniker wrote:

I am using NSTask and NSPipe to wrap a unix command in a GUI. I've followed most of the standard examples that use pipes to handle stdin, stdout, and stderr and they make sense to me. But how do I deal with interaction after the task is launched? For example, let's say I'm trying to wrap something like scp that can't be passed a password from the command line. How can I direct the password prompt to the GUI and send it back to the task? Should I parse the NSData coming up the pipe and look for the substring "password", or is there a slicker way to do this?

The specific example you give though (scp) has a slicker solution. The SSH family of apps uses an environment variable named SSH_ASKPASS. If SSH is not connected to a terminal, and this variable is set, SSH will run the app it points to instead of asking for a password on stdin. Google for Bill Bumgarner's SSHPassKey app for an example of doing this. It prompts the user for SSH login information, and can optionally store and retrieve the information using the keychain.

That's not a standardized feature though, so for other tools you might very well be limited to parsing its output and handing it input.

sherm--
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >NSTask Question (From: Glenn Zelniker <email@hidden>)

  • Prev by Date: Re: kCFPreferencesAnyUser w/PreferencePane not working?
  • Next by Date: Re: NSTask Question
  • Previous by thread: NSTask Question
  • Next by thread: Re: NSTask Question
  • Index(es):
    • Date
    • Thread