in reply to IPC::Open2, Tk, and DOS window

A very similar post was made yesterday (Launching a Win32::GUI app without launching a terminal). You might want to check it out.

"Make everything as simple as possible, but not simpler." -- Albert Einstein

Replies are listed 'Best First'.
Re: Re: IPC::Open2, Tk, and DOS window
by Eradicatore (Monk) on Oct 03, 2001 at 20:34 UTC
    Thanks, but I'm already able to do this easily with the aforementioned code, and BTW I'm using Tk, not win32::gui. I appreciate the reply though.

    Maybe I should clarify some more. I'm able to remove the console DOS window with this above code, but when you do that it appears to wreak havoc with the IPC::Open2 function that wants to communicate to the child process on the child process's STDIN. I assume this is because removing the DOS console removes the connnection to both STDIN and STDOUT of the parent. What really confuses me though is that I'm not really trying to use STDOUT on the parent. I thought I was just using a filehandle and only the child process has to have STDIN.

    Justin Eltoft

    "If at all god's gaze upon us falls, its with a mischievous grin, look at him" -- Dave Matthews

      Re-reading my post I realize the intent wasn't phrased clearly. The referenced link showed alternate ways to run perl programs without a DOS console, not necessarily just those using Win32::Gui, but Tk as well. Unfortunately, all the methods described likely have the same problem with STDIN/STDOUT.

      "Make everything as simple as possible, but not simpler." -- Albert Einstein

      IPC::Open2 always has the child's STDERR go to the parent's STDERR. This may cause problems if the parent no longer has a STDERR.

      I'd try using IPC::Open3 and be sure to specify alternates for all three. Note that having the child's STDOUT and STDERR go to separate pipes can lead to deadlock so either send them both to the same pipe or send one or both of them to a file or even:

      open(NUL,">nul") or die "nul: $!"; open3( ...., \*NUL, ... )
      [ BTW, I think IPC::Open3 should be patched to handle     open3( "<nul", ">out.txt", ">err.txt", ... ) (: ]

              - tye (but my friends call me "Tye")