• 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: Spawn process without inheriting parent stdout, stdin
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Spawn process without inheriting parent stdout, stdin


  • Subject: Re: Spawn process without inheriting parent stdout, stdin
  • From: "Corey O'Connor" <email@hidden>
  • Date: Fri, 30 Sep 2005 15:45:38 -0700

On 9/30/05, Matthew Jaffa <email@hidden> wrote:
> Here is my problem:
>
> App1 calls App2   and App2 calls App3,  now App2 depends on the return codes
> of App3.
> But somehow App2 is always getting the same return code because maybe App1
> is swallowing up App3's ouput since he is the overall parent of all of them.
> App2 needs to capture App3's stdout but for some reason it seems to be not
> returning correctly.
>
> Am I making any sense here???

Just so it's clear: No re-routing of stdout is happening in any of
this right now? By "return code" you mean "what's written to App3's
stdout" and not what is returned from main?

if so, App1, App2, and App3 all have the same stdout. If you want App2
to capture the stdout and be the provider of stdin for App3 I'd
suggest using a pipe.

I'm unfamiliar with using pipe's with the Foundation API, but here's a
guess how:

let thePipe = a NSPipe.
let app3Task = the NSTask for App3
[app3Task setStandardOutput: [thePipe fileHandleForWriting]]

Then the parent process can read from App3's stdout using [thePipe
fileHandleForReading]

If, however, you just want the return code returned by App3's main...
That's unrelated to stdout.

--
-Corey O'Connor
 _______________________________________________
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: Spawn process without inheriting parent stdout, stdin
      • From: "Corey O'Connor" <email@hidden>
References: 
 >Re: Spawn process without inheriting parent stdout, stdin (From: Sherm Pendley <email@hidden>)
 >Re: Spawn process without inheriting parent stdout, stdin (From: "Matthew Jaffa" <email@hidden>)

  • Prev by Date: Re: Spawn process without inheriting parent stdout, stdin
  • Next by Date: Re: Spawn process without inheriting parent stdout, stdin
  • Previous by thread: Re: Spawn process without inheriting parent stdout, stdin
  • Next by thread: Re: Spawn process without inheriting parent stdout, stdin
  • Index(es):
    • Date
    • Thread