IPC-Run
IPC-Run copied to clipboard
Behavior change for undef params in 20180523.0
Before 20180523.0, something like run([$^X], \undef, \undef, \undef, undef)
or even run([$^X], \undef, undef)
would run without an exception. As of the change introduced by #118, this fails with Modification of a read-only value attempted at /home/greg/MaxMind/IPC-Run/lib/IPC/Run.pm line 1686.
. Changing:
@args = map { !defined $_ ? bless(\$_, 'IPC::Run::Undef') : $_ } @_;
to:
@args = map { my $v = $_; !defined $v ? bless(\$v, 'IPC::Run::Undef') : $v } @_;
fixes that particular error, but it later fails with other errors. This appears to be because the later code uses ref
and length
in ways incompatible with undef
being replaced by IPC::Run::Undef
.
@oschwald is there a reason you can't change that to:
run([$^X])
@toddr, we've worked around the particular issue, but it was a backwards incompatible behavior change not explicitly mentioned in the docs.
If I recall correctly, the reason why the code was like that is that we were conditionally passing in those params. Now we have to check whether we've passed them in.
The whole interface is a big mess. I don't think I would make any of the existing decisions if I had to re-write it.
Should we either make the docs reflect the current code, or adjust the code to match the docs?
run([$^X])
does not close the descriptors. Using \undef
to close a descriptor is the most easiest way. But due to this bug, one cannot do that. This really should be documented or fixed.