Greetings all my fellow monks,
After running this line:
where cmd is a little program written in C, which mainly does some printf stuff.run \@cmd, \$in, \$out, \$err, timeout( 3, exception => 'timeout' );
#!/usr/bin/perl -w use strict; use warnings; use CGI qw/:standard/; use CGI::Carp qw/fatalsToBrowser warningsToBrowser/; use IPC::Run qw/run timeout/; if (param('in')) { $in = param('in'); print p("Input: $in\n"); } else { undef $in; } my @cmd = ( "/data2/tmp/a.exc" ); eval { local $| = 1; run \@cmd, \$in, \$out, \$err, timeout( 3, exception => 'timeo +ut' ); }; print "Timed out...\n\n" if $@ =~ /timeout/; print "ERROR: $err\n\n" if $err; chomp($out) && print "Output: $out\n" if $out; print "Expected output: ", param('out') if param('out');
Update 2:
Sorry, I think it's all my fault:
chomp($out) && print "Output: $out\n" if $out;
This is where the problem lies...after removing chomp($out) &&, things back to normal again. Now I don't know what to say or explain....
A letter to NodeReaper:
The connection here was kinda weird on my attempt to send replies to this node.
I could reach the preview page at a good speed, but when I did the real submission, things became very slow, and finally I got a ``content-length: 0'' on my Opera window...
I think that's why you got many empty nodes. It's okay now.
In reply to Get output after running IPC::Run by pid
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |