in reply to open2 on Windows NT

I don't fully understand what you said. Did you mean that some other simple script that called open2 just to make sure it was implemented worked OK, but the specific call in your real program hangs?

If that's the case, try looking at the actual argument. Does the simple test program open2 the same process with same arguments? If using a string generated at run time, dump that and check for the unexpected. Post a more detailed example.

—John

Replies are listed 'Best First'.
Re: Re: open2 on Windows NT
by zlatkovic (Initiate) on May 31, 2001 at 17:57 UTC
    I have written a perl module to interface to a cli ui. Here is a snippet of code from the module
    use IPC::Open2; use Symbol; sub connect_to_cli { my $rdr = gensym(); my $wtr = gensym(); my $pid = open2( $rdr, $wtr, $cmdline ); return $pid; }
    And from a script that uses that module
    use MyModule; my $session = new MyModule(); $pid = $session->connect_to_cli();
    Running the perl script causes things to get stuck on the open2 call. But if I use the open2 call in a perl script it works fine.
    use IPC::Open2; use Symbol; my $rdr = gensym(); my $wtr = gensym(); my $pid = open2( $rdr, $wtr, $cmdline ); print "pid = $pid\n";
    Soraia

    Edit by tye

      Your connect_to_cli is "throwing away" $rdr and $wtr (which should close them) and this may be causing your problems (it certainly makes this subroutinen pretty useless).

              - tye (but my friends call me "Tye")
      Please insert some <CODE> tags around that, and eyeball it in the preview window before submitting—your code is all flowed into a paragraph (see Site How To).

      IAC, print out the value of $cmdline just before making the call to make sure it's as you think it should be.