Simplify the test for IPC::Open bug RT #72016.
authorNicholas Clark <nick@ccl4.org>
Sun, 5 Jun 2011 15:06:14 +0000 (17:06 +0200)
committerNicholas Clark <nick@ccl4.org>
Sat, 11 Jun 2011 06:48:13 +0000 (08:48 +0200)
commit8025b67f4a91c89c84e9425f55ca42755a7d5530
treee6116e1a407522f46d503f14d2e36712e43946e8
parent26126efb9b317f88a49cd14c7ef5c20eb0cb68b1
Simplify the test for IPC::Open bug RT #72016.

The original bug was a request that errors be reported in the parent process,
with a TODO test, and then a patch that added the feature for the !DO_SPAWN
case, and removed the TODO. The *implication* of the bug report and the way the
original test was only TODO for the !DO_SPAWN case was that errors were
reported inconsistently between the two code paths of open3().

However, this is not the case - the DO_SPAWN path through open3() return a
(pseudo) PID (and no error) when asked to run a non-existent program. Hence
there is now a feature discrepancy between the alternative implementations,
which feels like a bug that should (ultimately) be addressed.

The original test could have expressed that more directly with one code path
and a TODO. The refactoring of bd29e8c290c68f4f failed to spot this, and
introduced new logic errors in the DO_SPAWN path - waitpid() should not be
called if $@ is set.

Set $pid outside the eval {} - this makes sure it is (re)set to undef if the
eval fails, instead of holding its previous (now bogus) value.
ext/IPC-Open3/t/IPC-Open3.t