• 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: fork, pipes, and Tiger
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fork, pipes, and Tiger


  • Subject: Re: fork, pipes, and Tiger
  • From: Andrew Farmer <email@hidden>
  • Date: Thu, 9 Nov 2006 12:22:06 -0800

On 09 Nov 06, at 08:53, Dale Miller wrote:
I put together an application which does the following:
1) Uses NSTask to set up a process
2) defines 3 pipes for stdin, stdout, and stderr to communicate to the process
3) sets up the desired parms and selects "/bin/bash" as the program path.
4) launches bash.
5) everything works beautifully
a) commands typed in are picked up by bash from the stdin pipe
b) bash output goes back to the application on the stdout pipe
c) if I, for example, type an invalid command, the error message comes back properly on the stderr pipe.
d) however, I get no Prompt.
6) If I change the bash parms to include the -i flag:
a) Nothing comes back on stdout or stderr
b) The bash process is in a hard loop (near 100% processor activity)
c) It has to be killed with "force quit"
7) If I chage the stderr assignment to a disk file, the prompts and errors go to the disk file as expected.
8) If I remove the stderr assignment, and run the application from XCODE, the prompts and error message show up
in the run log window

You probably want a pty, not pipes. Look up the forkpty() function. You'll have to do a little extra work to turn the returned fd into something more Cocoa-like, but it'll behave much better with interactive applications.
_______________________________________________
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: 
 >Re: fork, pipes, and Tiger (From: Dale Miller <email@hidden>)

  • Prev by Date: Re: NSTableView, columns only (live)resize without data
  • Next by Date: Re: Accessing structure member NSDate in NSTableView
  • Previous by thread: Re: fork, pipes, and Tiger
  • Next by thread: Accessing structure member NSDate in NSTableView
  • Index(es):
    • Date
    • Thread