Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Open3 and bad gut feeling

by particle (Vicar)
on Feb 20, 2002 at 08:04 UTC ( #146520=note: print w/replies, xml ) Need Help??

in reply to Open3 and bad gut feeling

coreolyn, i've been following this node very closely. you can see by my replies that i have been trying to solve a similar issue. i was never satisfied with my implementation... mostly due to tilly's constant, nagging reminders to use select :)

well, i did a little investigation on select, and i found some interesting things you'll appreciate. for instance, select is only implemented on sockets in Win32. hrmm. also, open2/open3 cannot redirect input/output in a child process via fork in Win32. i'm afraid a lot of the code you have there is not doing anything useful.

here's a list of links for more information:

IO::Select on Windows
stdin-socket without fork()??

here's a test script to verify select is in fact, not working. can_write, can_read, and has_exception all come back undef on Win32... (see below)

#!/usr/bin/perl use IO::Select; # create typeglobs and add to selector $output_select = IO::Select->new( *CMD_ERR, *CMD_OUT, *CMD_IN ); # test selector methods $cnt = $output_select->count(); print "count: $cnt\n"; @bob = $output_select->handles(); print "list: @bob\n"; @bob = $output_select->can_write(10); print "write: @bob\n"; @bob = $output_select->can_read(10); print "read: @bob\n"; @bob = $output_select->has_exception(10); print "exception: @bob\n"; close(CMD_IN); close(CMD_OUT); close(CMD_ERR);
i'm now working on a client / server solution for executing external programs and redirecting output using sockets. as soon as i have something solid, i'll be sure to post it, and /msg you with the node_id.

thank you for using microsoft ;-D


Replies are listed 'Best First'.
Re^2: Open3 and bad gut feeling
by Random_Walk (Prior) on Mar 31, 2005 at 14:00 UTC

    Hi particle

    I have been working on a similar problem Win32 capturing output from a process that may hang, capturing stdout and stderr from a child proc, must work under windows and unix and there is a good chance the child will hang and have to be killed.

    I have a partial solution at Re^4: Win32 capturing output from a process that may hang using threads and non blocking thread queues. This does not however do stderr properly. I have started trying to use open3 for this but have found it a can of worms. Did you get anywhere with the client server socket talking approach ?


    Pereant, qui ante nos nostra dixerunt!

      actually, i later found IPC::Run, which does a great job for me, even though it says win32 support is *experimental*. in fact, i'm using happily using it right now to glue two apps together :)

      ~Particle *accelerates*

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://146520]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2018-06-23 03:01 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.