I'm using IPC::Run with timeouts and I am getting an odd error:
Modification of a read-only value attempted at ${HOME}/perl5/lib/perl5/IPC/Run.pm line 1693.
use strict;
use warnings;
use IPC::Run qw(timeout);
my $job_command = '/bin/ls';
my $timeout_value = 20;
my $t = timeout($timeout_value);
IPC::Run::run($job_command, undef, undef, undef, $t);
Anyone have experience w/ this?
Edited to add that this is the results w/ perl v5.16.3 and v5.22.0 w/ IPC::Run version 20200505.0
undef is not a valid argument.
Simply use
IPC::Run::run($job_command, $t);
Test:
use IPC::Run qw( run timeout );
run([ 'perl', '-e', 'sleep' ], timeout(5));
Output:
IPC::Run: timeout on timer #1 at /home/ikegami/usr/perlbrew/perls/5.32.0t/lib/site_perl/5.32.0/IPC/Run.pm line 2951.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With