Perl IPC::Cmd doesn't run application if PATH env variable is initialized -


i'm writing test script library i've written, , part of test i'm clearing $env{path} variable make sure things i've put in path don't cause successes. library appends needed paths path variable.

for background, i'm running strawberry perl v5.12.0 on 32-bit windows xp. ipc::cmd @ version 0.76 , ipc::open3 @ version 1.05.

the error i'm seeing if clear path variable , set it, ipc::cmd using ipc::open3 not find application. if don't this, it'll run fine. here's example script illustrates error:

use strict; use warnings; use ipc::cmd qw(run);  $env{path} = ''; $env{path} = 'c:\\strawberry\\perl\\bin';  ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =     run(command => 'perl -v', verbose => 0);  if ($success) {      print 'success: ';     print join("\n", @{$stdout_buf}); } else {      print 'failure: ';     print join("\n", @{$full_buf}); } exit 0; 

if run this, prints failure line, , if run 2 $env{path} = commented out prints success line. i've tried mucking around second path line changing slashes , adding slashes @ end, no good.

i've run through debugger, , failure occurs on line 398 in ipc::open3: $pid = eval { system 1, @_ }; # 1 == p_nowait. if check $! after line, tells me 'no such file or directory'. path still set correctly @ point, it's not getting altered @ point.

one other odd point, i've tried using can_run method ipc::cmd after resetting path, , it'll find command no problem.

before submitting bug report this, has seen , know how fix it? also, i'm trying do, correct way, or there better way reset path variable testing?

the issue here windows requires %windir%\system32 in path env variable well. adding this, , 'c:\strawberry\perl\bin' resolved issue.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -