• 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, NSPipe's and interactive UNIX command
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask, NSPipe's and interactive UNIX command


  • Subject: Re: NSTask, NSPipe's and interactive UNIX command
  • From: Thomas Deniau <email@hidden>
  • Date: Thu, 03 Jan 2002 00:51:47 +0100

Le 2/01/02 15:40, [NAME] disait :

> The problem is that notifications of available data on the output pipe
> are fired only *after* "command" has exited! That is, the behaviour of
> this code is as follows: "command" is run but no output is shown;
> however, if the user presses a key, this is correctly sent to the input
> pipe, so "command" (which was hanging on getchar()) goes on, writes
> some other text and exits. At this point only notifications of available
> data are sent, so the program displays all the output of "command",
> before and after getchar()! I do not understand why. Can someone give me
> some hint? Am I doing something wrong? If this is a bug, does a
> workaround exist?

If had the same problem.
If you control command's code, just add fflush(stdout); where you use
printf.
This solved the problem for me.

(In fact I eventually used distributed notifications & distributed objects
to have a more flexible way of handling output)

--
Thomas Deniau


References: 
 >NSTask, NSPipe's and interactive UNIX command (From: Nicola Vitacolonna <email@hidden>)

  • Prev by Date: Re: Apple's Address Book File Format
  • Next by Date: Re: Apple's Address Book File Format
  • Previous by thread: Re: NSTask, NSPipe's and interactive UNIX command
  • Next by thread: Re: NSTask, NSPipe's and interactive UNIX command
  • Index(es):
    • Date
    • Thread