GithubHelp home page GithubHelp logo

pjf / ipc-system-simple Goto Github PK

View Code? Open in Web Editor NEW
19.0 8.0 20.0 303 KB

Perl module to make running system commands and capturing errors as simple as possible.

Home Page: http://search.cpan.org/perldoc?IPC::System::Simple

License: Other

Perl 99.84% C 0.16%

ipc-system-simple's Introduction

This archive contains the distribution IPC-System-Simple,
version 1.27:

  Run commands simply, with detailed diagnostics

This software is copyright (c) 2020 by Paul Fenwick.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.


This README file was generated by Dist::Zilla::Plugin::Readme v6.012.

ipc-system-simple's People

Contributors

dsteinbrunner avatar eserte avatar jkeenan avatar jwilk avatar karenetheridge avatar pjf avatar ppisar avatar theory avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ipc-system-simple's Issues

Windows Failure with Spaces in Path

Hi. I'm finding IPC::System::Simple's system isn't a drop-in replacement for the built-in system in some circumstances involving spaces in a filename being supplied to a command.

For instance, this works, opening or focussing an Explorer window on C:\Program Files:

C:\>perl -E "system qw<cmd /C start /D>, 'C:\Program Files', '.'"

but substituting in IPC::System::Simple's system makes it fail:

C:\>perl -MIPC::System::Simple=system -E "system qw<cmd /C start /D>, 'C:\Program Files', '.'"
The system cannot find the file Files.
"cmd" unexpectedly returned exit value 1 at -e line 1

That also pops up an error box with the message “Windows cannot find 'Files'. Make sure you typed the name correctly, and then try again.”

This doesn't happen with all circumstances in which arguments have spaces in them; it may even be specific to the start command, but clearly what IPC::System::Simple is doing is having some influence on it.

Let me know if there's anything further I can help with.

Multi-argument run() fails on Windows when first parameter is a full path that contains spaces

Tests 1 and 2 below fail, but 3 and 4 work. The third one isn't great, because it makes me responsible for properly quoting the entire command. The fourth one isn't great either, because the thing we want to run might not be in the PATH.

use strict;
use warnings;

use Data::Dumper;
use IPC::System::Simple qw(run);

my @tests = (
    ['C:\Program Files\TortoiseSVN\bin\svn.exe', 'help'],
    ['"C:\Program Files\TortoiseSVN\bin\svn.exe"', 'help'],
    ['"C:\Program Files\TortoiseSVN\bin\svn.exe" help'],
    ['svn', 'help'],
);

for (@tests) {
    print "Running with run(): ", Dumper($_), "\n";

    eval {
        run(@$_);
    };

    if ($@) {
        print "Error: [$@]\n";
    }
}

t/07-taint.t may fail (on env var TEST_ACTIVE)

In rare cases t/07-taint.t fails:

#   Failed test 'Sanity - ENV vars are tainted'
#   at t/07_taint.t line 21.

#   Failed test 'Sanity - Evil zero is tainted'
#   at t/07_taint.t line 25.

#   Failed test 'Single-arg, tainted data'
#   at t/07_taint.t line 41.
#                   ''
#     doesn't match '(?^:called with tainted argument)'

#   Failed test 'multi-arg, tainted data'
#   at t/07_taint.t line 44.
#                   ''
#     doesn't match '(?^:called with tainted argument)'
# Looks like you failed 4 tests of 13.
t/07_taint.t .............. 
Dubious, test returned 4 (wstat 1024, 0x400)
Failed 4/13 subtests 

The rare failures can be made happen more often by cleaning the environment (just keeping PATH):

$ env -i PATH=$PATH perl5.25.12 -Mblib -T t/07_taint.t 
1..13
ok 1 - $perl_path is clean
ok 2 - use IPC::System::Simple;
not ok 3 - Sanity - ENV vars are tainted
#   Failed test 'Sanity - ENV vars are tainted'
#   at t/07_taint.t line 21.
not ok 4 - Sanity - Evil zero is tainted
#   Failed test 'Sanity - Evil zero is tainted'
#   at t/07_taint.t line 25.
ok 5 - Sanity - Evil zero is still zero
ok 6 - Single-arg, tainted ENV
ok 7 - Multi-arg, tainted ENV
not ok 8 - Single-arg, tainted data
#   Failed test 'Single-arg, tainted data'
#   at t/07_taint.t line 41.
#                   ''
#     doesn't match '(?^:called with tainted argument)'
not ok 9 - multi-arg, tainted data
#   Failed test 'multi-arg, tainted data'
#   at t/07_taint.t line 44.
#                   ''
#     doesn't match '(?^:called with tainted argument)'
ok 10 - Single-arg, clean data and ENV
ok 11 - Multi-arg, clean data and ENV
ok 12 - Returns of multi-arg capture should be tainted
ok 13 - Returns of single-arg capture should be tainted
# Looks like you failed 4 tests of 13.

If adding some diagnostics into the test file to print out the first key in %ENV, then it's always TEST_ACTIVE --- probably added by the testing framework, and it seems that this environment variable is treated specially.

runx Sometimes Fails to Pass Paths with Spaces In Them on Windows

As originally reported in /sqitchers/sqitch#331. Note that the OP, @NorthLarry, found that passing a path with a space to psql failed, but not when passing it to notepad. Both work fine on the command-line, of course.

Tests:

perl -MIPC::System::Simple=runx -e "runx @ARGV" psql -f "C:\path\with some spaces/deploy/some_script.sql"
perl -MIPC::System::Simple=runx -e "runx @ARGV" notepad "C:\path\with some spaces/deploy/some_script.sql"

t/08_core.t fails, due to different die message

1..3
ok 1 - use IPC::System::Simple;
ok 2 - Signal caught,   $? = 6
not ok 3 - Coredump caught, $? = 6
#   Failed test 'Coredump caught, $? = 6'
#   at t/08_core.t line 51.
#                   '"/usr/bin/perl" died to signal "ABRT" (6) at t/08_core.t line 47.
# '
#     doesn't match '(?^:dumped core)'
# Looks like you failed 1 test of 3.
This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi

uname -a says: Linux vagrant-sandbox 3.2.0-101-generic #141-Ubuntu SMP Thu Mar 10 21:43:24 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Let me know if I can provide more info or help diagnose further.

Windows 10 issue on 5.30.2

Cannot install lastest IPC::System::Simple version for what seems to be a variety of issues:

cpanm (App::cpanminus) 1.7044 on perl 5.030002 built for MSWin32-x64-multi-thread
Work directory is C:\Users\TOMBLO~1/.cpanm/work/1591174710.30836
You have make "C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\c\bin\gmake.exe"
You have LWP 6.43
Falling back to Archive::Tar 2.36
Searching IPC::System::Simple () on cpanmetadb ...
--> Working on IPC::System::Simple
Fetching http://www.cpan.org/authors/id/J/JK/JKEENAN/IPC-System-Simple-1.30.tar.gz
-> OK
Unpacking IPC-System-Simple-1.30.tar.gz
Entering IPC-System-Simple-1.30
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.44)
Configuring IPC-System-Simple-1.30
Running Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for IPC::System::Simple
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Scalar::Util 0 ... Yes (1.54)
Checking if you have Exporter 0 ... Yes (5.74)
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.44)
Checking if you have Win32::Process 0 ... Yes (0.16)
Checking if you have warnings 0 ... Yes (1.44)
Checking if you have POSIX 0 ... Yes (1.88)
Checking if you have Carp 0 ... Yes (1.50)
Checking if you have Test 0 ... Yes (1.31)
Checking if you have List::Util 0 ... Yes (1.54)
Checking if you have Win32::ShellQuote 0 ... Yes (0.003001)
Checking if you have File::Basename 0 ... Yes (2.85)
Checking if you have strict 0 ... Yes (1.11)
Checking if you have constant 0 ... Yes (1.33)
Checking if you have Test::More 0 ... Yes (1.302172)
Checking if you have re 0 ... Yes (0.37)
Building and testing IPC-System-Simple-1.30
cp lib/IPC/System/Simple.pm blib\lib\IPC\System\Simple.pm
"C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/01_load.t ........... ok
'C:\Users\Tom' is not recognized as an internal or external command,
operable program or batch file.
"C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe exiter.pl 0" unexpectedly returned exit value 1 at t/02_exit.t line 32.
# Looks like your test exited with 255 just after 12.
t/02_exit.t ........... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 16/28 subtests 
t/03_signal.t ......... skipped: Signals not implemented on Win32
"C:\Users\Tom" failed to start: "The filename, directory name, or volume label syntax is incorrect" at t/04_capture.t line 25.
# Looks like your test exited with 25 just after 1.
t/04_capture.t ........ 
Dubious, test returned 25 (wstat 6400, 0x1900)
Failed 11/12 subtests 
t/05_multi_capture.t .. ok
t/06_fail.t ........... ok

#   Failed test '$perl_path is clean'
#   at t/07_taint.t line 14.

#   Failed test 'Single-arg, tainted ENV'
#   at t/07_taint.t line 32.
#                   'IPC::System::Simple::run called with tainted argument "C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe exiter.pl 0" at t/07_taint.t line 31.
# '
#     doesn't match '(?^:called with tainted environment)'

#   Failed test 'Multi-arg, tainted ENV'
#   at t/07_taint.t line 35.
#                   'IPC::System::Simple::run called with tainted argument "C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe" at t/07_taint.t line 34.
# '
#     doesn't match '(?^:called with tainted environment)'

#   Failed test 'Single-arg, clean data and ENV'
#   at t/07_taint.t line 47.
#          got: 'IPC::System::Simple::run called with tainted argument "C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe exiter.pl 0" at t/07_taint.t line 46.
# '
#     expected: ''

#   Failed test 'Multi-arg, clean data and ENV'
#   at t/07_taint.t line 50.
#          got: 'IPC::System::Simple::run called with tainted argument "C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe" at t/07_taint.t line 49.
# '
#     expected: ''

#   Failed test 'Returns of multi-arg capture should be tainted'
#   at t/07_taint.t line 53.

#   Failed test 'Returns of single-arg capture should be tainted'
#   at t/07_taint.t line 56.
# Looks like you failed 7 tests of 13.
t/07_taint.t .......... 
Dubious, test returned 7 (wstat 1792, 0x700)
Failed 7/13 subtests 
t/08_core.t ........... skipped: BSD::Resource required for coredump tests
'C:\Users\Tom' is not recognized as an internal or external command,
operable program or batch file.
"C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe exiter.pl 0" unexpectedly returned exit value 1 at t/09_system.t line 21.
# Looks like your test exited with 255 just after 1.
t/09_system.t ......... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 23/24 subtests 
t/10_formatting.t ..... ok
'C:\Users\Tom' is not recognized as an internal or external command,
operable program or batch file.

#   Failed test 'Run works with single arg'
#   at t/11_newlines.t line 15.
#          got: '"C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe -e1" unexpectedly returned exit value 1 at t/11_newlines.t line 14.
# '
#     expected: ''
'C:\Users\Tom' is not recognized as an internal or external command,
operable program or batch file.

#   Failed test 'Run works with \n'
#   at t/11_newlines.t line 18.
#          got: '"C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe -e1
# " unexpectedly returned exit value 1 at t/11_newlines.t line 17.
# '
#     expected: ''
'C:\Users\Tom' is not recognized as an internal or external command,
operable program or batch file.

#   Failed test 'Run works with \r\n'
#   at t/11_newlines.t line 21.
#          got: '"C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe -e1

# " unexpectedly returned exit value 1 at t/11_newlines.t line 20.
# '
#     expected: ''

#   Failed test 'Run works with single arg'
#   at t/11_newlines.t line 24.
#          got: '"C:\Users\Tom" failed to start: "The filename, directory name, or volume label syntax is incorrect" at t/11_newlines.t line 23.
# '
#     expected: ''

#   Failed test 'Run works with \n'
#   at t/11_newlines.t line 27.
#          got: '"C:\Users\Tom" failed to start: "The filename, directory name, or volume label syntax is incorrect" at t/11_newlines.t line 26.
# '
#     expected: ''

#   Failed test 'Run works with \r\n'
#   at t/11_newlines.t line 30.
#          got: '"C:\Users\Tom" failed to start: "The filename, directory name, or volume label syntax is incorrect" at t/11_newlines.t line 29.
# '
#     expected: ''
# Looks like you failed 6 tests of 6.
t/11_newlines.t ....... 
Dubious, test returned 6 (wstat 1536, 0x600)
Failed 6/6 subtests 
'C:\Users\Tom' is not recognized as an internal or external command,
operable program or batch file.

#   Failed test 'system invokes the shell'
#   at t/12_systemx.t line 23.
#          got: '"C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe exiter.pl 0" unexpectedly returned exit value 1 at t/12_systemx.t line 20.
# '
#     expected: ''

#   Failed test 'capture invokes the shell'
#   at t/12_systemx.t line 42.
#                   undef
#     doesn't match '(?^:Hello)'
# Looks like you failed 2 tests of 7.
t/12_systemx.t ........ 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/7 subtests 
t/13_exports.t ........ ok
t/14_uninitialised.t .. ok
'C:\Users\Tom' is not recognized as an internal or external command,
operable program or batch file.

#   Failed test 'Should have no error from run with redirection'
#   at t/args.t line 75.
#          got: '"C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe output.pl > test.tmp" unexpectedly returned exit value 1 at t/args.t line 74.
# '
#     expected: ''

#   Failed test 'Should have exit 0 from run with redirection'
#   at t/args.t line 76.
#          got: undef
#     expected: '0'

#   Failed test 'Should have redirected text run'
#   at t/args.t line 77.
#          got: ''
#     expected: 'Hello
# Goodbye
# '
'C:\Users\Tom' is not recognized as an internal or external command,
operable program or batch file.

#   Failed test 'Should have no error from systemx with redirection'
#   at t/args.t line 80.
#          got: '"C:\Users\Tom Bloor\_psperl\_perls\perl64-5.30.2.1\perl\bin\perl.exe output.pl > test.tmp" unexpectedly returned exit value 1 at t/args.t line 79.
# '
#     expected: ''

#   Failed test 'Should have exit 0 from systemx with redirection'
#   at t/args.t line 81.
#          got: undef
#     expected: '0'

#   Failed test 'Should have redirected text systemx'
#   at t/args.t line 82.
#          got: ''
#     expected: 'Hello
# Goodbye
# '

#   Failed test 'Should have no error from single-string capture'
#   at t/args.t line 86.
#          got: '"C:\Users\Tom" failed to start: "The filename, directory name, or volume label syntax is incorrect" at t/args.t line 85.
# '
#     expected: ''

#   Failed test 'Should have output from capture'
#   at t/args.t line 87.
#          got: undef
#     expected: 'Hello
# Goodbye
# '
# Looks like you failed 8 tests of 56.
t/args.t .............. 
Dubious, test returned 8 (wstat 2048, 0x800)
Failed 8/56 subtests 
t/internal.t .......... ok
t/win32.t ............. ok

Test Summary Report
-------------------
t/02_exit.t         (Wstat: 65280 Tests: 12 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 28 tests but ran 12.
t/04_capture.t      (Wstat: 6400 Tests: 1 Failed: 0)
  Non-zero exit status: 25
  Parse errors: Bad plan.  You planned 12 tests but ran 1.
t/07_taint.t        (Wstat: 1792 Tests: 13 Failed: 7)
  Failed tests:  1, 6-7, 10-13
  Non-zero exit status: 7
t/09_system.t       (Wstat: 65280 Tests: 1 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 24 tests but ran 1.
t/11_newlines.t     (Wstat: 1536 Tests: 6 Failed: 6)
  Failed tests:  1-6
  Non-zero exit status: 6
t/12_systemx.t      (Wstat: 512 Tests: 7 Failed: 2)
  Failed tests:  1, 4
  Non-zero exit status: 2
t/args.t            (Wstat: 2048 Tests: 56 Failed: 8)
  Failed tests:  49-56
  Non-zero exit status: 8
Files=17, Tests=167,  6 wallclock secs ( 0.08 usr +  0.03 sys =  0.11 CPU)
Result: FAIL
Failed 7/17 test programs. 23/167 subtests failed.
gmake: *** [Makefile:897: test_dynamic] Error 255
-> FAIL Installing IPC::System::Simple failed. See C:\Users\TOMBLO~1\.cpanm\work\1591174710.30836\build.log for details. Retry with --force to force install it.

From the list, seems that, at a minimum #9 is an issue still, as well as #34. Note the perl was installed using psperl

Core dump file remains on disk after running t/08_core.t on FreeBSD

In the course of working on #39, I had occasion to install CPAN module BSD::Resource on the machines on which I had previously worked on IPC-System-Simple. Once I did so, test program t/08_core.t was no longer skipped. When it ran, it PASSed on both Linux and FreeBSD. However, on FreeBSD running that file deposited a core dump file in t/perl.core; no such core dump remained after running the test on Linux.

This was surprising. I peeked into t/08_core.t and saw this code:

# Core dumps on OS X are complicated. See GH #5.

BEGIN {
    if ($^O eq 'darwin') {
        plan skip_all => "Coredump tests skipped under OS X/Darwin";
    }
}

So at some point in the past, it was seen fit to skip the core tests on Darwin. (I don't currently have a working Mac.) Was this because t/perl.core was not cleaned up, or for some other reason? Should the prohibition against running coredump tests on Darwin be extended to FreeBSD which, in the long distant past, was an ancestor of Darwin? And against other OSes as well?

@pjf, do you have any thoughts about this?

Make IPC::System::Simple respect Win32::SetChildShowWindow

Hi, it would be nice if IPC::System::Simple could be enhanced to respect Win32::SetChildShowWindow.

Specifically, the following should have the same behaviour (excepting error handling):

#!wperl
use Win32;
Win32::SetChildShowWindow(0);
system("some command and args");
#!wperl
use Win32;
use IPC::System::Simple qw(system);
Win32::SetChildShowWindow(0);
system("some command and args");

At the moment, on Win32, when run with wperl, the former works as expected, while the latter (at least with perl v5.22) creates a new console window to run the command. When run with regular perl, the behaviour is identical, perl opens a new console window, and whatever output the command has appears in that window.

From a little investigation, Win32::Process would need to be extended in some manner in order to pass in whatever flag causes CORE::system to hide the console window, and Win32::SetChildShowWindow would possibly need a matching Win32::GetChildShowWindow to be able to read back the current setting..

capturex with spaces and an empty argument works fine on Linux - and fails on Win64 (Windows 7 Strawberry Perl)

The following program works fine on Linux, but fails on Win64 / Windows 7 x86-64 / Strawberry Perl 5.18.2:

use strict;
use warnings;

use IPC::System::Simple qw( capturex );

my $s =
capturex(
    $^X,
    "-e",
    'use Data::Dumper; print Dumper([@ARGV]);',
    '--',
    '-p', '',
);

print $s, "\n";

I am getting test failures for https://metacpan.org/release/App-Du-Analyze on Windows due to that. Please look into fixing it.

Regards,

-- Shlomi Fish

IPC::System::Simple can return "No child processes" (ECHILD) when $SIG{CHLD} is set.

(This issue was originally reported on Jun 05 2009 by [email protected] as
https://rt.cpan.org/Ticket/Display.html?id=46684. Transferring it to the
current issue tracker.)

Due to the way in which Perl internally handles the reaping of child
processes, the presence of a $SIG{CHLD} can prevent IPC::System::Simple
from gaining access to return information, which then causes it to throw
an exception claiming that it can't start the program, with No child processes as the reason why. Eg:

#!/usr/bin/perl -w
use strict;
use IPC::System::Simple qw(run);
use POSIX;

$SIG{CHLD} = sub { while (waitpid(-1,WNOHANG) > 0) { } };

run("echo hello world");

This looks like it may be hard to fix, but can be worked around by
temporarily unsetting the signal handler:

#!/usr/bin/perl -w
use strict;
use IPC::System::Simple qw(run);
use POSIX;

$SIG{CHLD} = sub { while (waitpid(-1,WNOHANG) > 0) { } };

{
    local $SIG{CHLD} = 'DEFAULT';
    run("echo hello world");
}

The only gotcha here is that if your existing signal handler actually
did something important, then we're breaking it for the duration of our
local block. If the existing signal handler was merely making sure
child processes get reaped (which is usually the case), then the code
above is harmless.

Can't clone the repo, missingSpaceBeforeDate

$ git clone [email protected]:pjf/ipc-system-simple.git
Cloning into 'ipc-system-simple'...
remote: Counting objects: 1397, done.
error: object 15e5d148b97530edfce26f0542aa043f917a5ae6: missingSpaceBeforeDate: invalid author/committer line - missing space before date
fatal: Error in object
fatal: index-pack failed

$ git --version
git version 2.9.2

There's a way to fix it at the bottom of https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History You should be able to use git cat-file -p 15e5d148 to find the offending name/email.

Test failures with Strawberry Perl 5.30.1

I am getting the following failures when trying to install v. 1.26 with Strawberry Perl 5.30.1 on Windows 10:
http://www.cpan.org/authors/id/J/JK/JKEENAN/IPC-System-Simple-1.26.tar.gz

Test Summary Report

t/04_capture.t (Wstat: 1024 Tests: 12 Failed: 4)
Failed tests: 3, 5, 7, 11
Non-zero exit status: 4
t/12_systemx.t (Wstat: 256 Tests: 7 Failed: 1)
Failed test: 4
Non-zero exit status: 1
t/win32.t (Wstat: 512 Tests: 33 Failed: 2)
Failed tests: 24, 26
Non-zero exit status: 2
Files=19, Tests=157, 2 wallclock secs ( 0.03 usr + 0.01 sys = 0.05 CPU)
Result: FAIL

Failed 3/19 test programs. 7/157 subtests failed.

gmake: *** [Makefile:877: test_dynamic] Error 2

Samples of failures:

t/03_signal.t ............ skipped: Signals not implemented on Win32
# Failed test 'Scalar capture'
# at t/04_capture.t line 28.
# got: ''
# expected: 'Hello
# Goodbye
# '
# Failed test 'capture and qx() return same results'
# at t/04_capture.t line 32.
# got: ''
# expected: 'Hello
# Goodbye
# '
# Failed test 'List capture'
# at t/04_capture.t line 39.
# Structures begin differing at:
# $got->[0] = Does not exist
# $expected->[0] = 'Hello
# '
# Failed test 'Single-arg capture still works'
# at t/04_capture.t line 59.
# ''
# doesn't match '(?^:Hello)'
# Looks like you failed 4 tests of 12.

Investigation

Did a build manually, and it seems that 04_capture.t when executing the Line 25:
my $output = capture($output_exe);

..., seems to read from stdin without echo, instead of executing the command $output_exe and reading its output. On my system during the test, the value of $output_exe is:
C:\strawberry\perl\bin\perl.exe output.pl

I went deeper and found that in sub _win32_capture:
$command contains: C:\strawberry\perl\bin\perl.exe output.pl
@args is empty!

So, later when the exe file is parsed out into $exe the output.pl part is lost and, because @args is empty, instead of the intended call to the output.pl script:
C:\strawberry\perl\bin\perl.exe output.pl
..., we get:
C:\strawberry\perl\bin\perl.exe
..., which just sits there when executed and waits for you to type in a perl script interactively.

Should arguments other than 'command' be checked for definedness?

In RT 41149 in 2008, checks were added to ensure that no undefined value was passed as the "command" element in the list of arguments to publicly available methods. However, at that time, Paul Fenwick wrote:

"I'd also like it to contain checks for any undefined elements being passed to IPC::System::Simple ...."

That was not completed at that time. However, in order to assess the benefits of warning or dieing on undefined values, we'd first have to have some plausible test cases where passing an undefined value other than to a command would be a bad thing, either because it caused a crash or bad result or because it generated a badly formatted error message or warning.

Until we get such test cases, this issue is stalled.

t/08_core.t fails on ASAN builds

On 5.39.2 built with config_args='-de -Dprefix=/home/s.aleinikov/perlbrew/perls/perl-blead-asan -Dman1dir=none -Dman3dir=none -DDEBUGGING -Dusedevel -Accflags=-fsanitize=address -fsanitize=undefined -ggdb3 -Aldflags=-Wl,--no-as-needed -lasan -lubsan -Aeval:scriptdir=/home/s.aleinikov/perlbrew/perls/perl-blead-asan/bin' I get the following test failure:

t/08_core.t ........... 1/3
#   Failed test 'Coredump caught, $? = 6'
#   at t/08_core.t line 49.
#                   '"/home/s.aleinikov/perlbrew/perls/perl-blead-asan/bin/perl5.39.2" died to signal "ABRT" (6) at t/08_core.t line 45.
# '
#     doesn't match '(?^:dumped core)'
# Looks like you failed 1 test of 3.
t/08_core.t ........... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests

The same failure happens on older perls too, I've checked it on 5.36.0 built with ASAN.

IPC::System::Simple adds commas to command line breaking everything

I am using autodie which uses IPC::System::Simple. IPC::System::Simple appears to be completely broken on Windows. It adds , (comma) after each command line argument. This is because it does this:

IPC::System::Simple::runx(C:/ActivePerl64/site/lib/IPC/System/Simple.pm:191):
191:            my $pid = _spawn_or_die($command, "$command @args");

The string interpolation seems to do that.

My version is 1.25, using ActivePerl.

t/08_core.t not working on OS X

On Mac OS X, core dumps are generated in the /cores directory. If the directory doesn't exist (the default) or isn't writable, no core dump is generated, and thus isn't shown in $? or ${^CHILD_ERROR_NATIVE}.

Incorrect dependency on BSD::Resource

AutoPrereqs picks up a dependency on BSD::Resource, though the test is obviously written with it as an optional dependency in mind. It should probably be removed from the dependency list (either by adding it to AutoPrereqs skiplist or by RemovePrereq'ing it).

System simple does not recognise metacharacters

I'm having problems with using system with metacharacters. I am trying to use system by passing in a single string including a file redirect, ">". I know the same code works on both linux and os x, but on Windows 8.1 using 64 bit strawberry perl 5.20.1.1, the system command fails to recognise the meta-character and split the command.

For Example: system("bwa mem file1 file2 > outputFile") passes ">outputFile" to the bwa executable as a parameter.

IPC-System-Simple-1.26-TRIAL: t/04_capture.t seems to hang on Strawberry Perl

Hello,

It seems to me that t/04_capture.t hangs on Windows as follows.

Strawberry Perl 5.20.3 on Windows 8.1 (64bit)

C:\home\grapefruit\IPC-System-Simple-1.26>perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a dmake-style Makefile
Writing Makefile for IPC::System::Simple
Writing MYMETA.yml and MYMETA.json

C:\home\grapefruit\IPC-System-Simple-1.26>dmake
cp lib/IPC/System/Simple.pm blib\lib\IPC\System\Simple.pm

C:\home\grapefruit\IPC-System-Simple-1.26>prove -lv t\04_capture.t
t\04_capture.t ..
1..12
ok 1 - use IPC::System::Simple;
(hangs)

Strawberry Perl 5.30.0 on Windows 8.1 (64bit)

C:\home\sunlight\IPC-System-Simple-1.26>perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for IPC::System::Simple
Writing MYMETA.yml and MYMETA.json

C:\home\sunlight\IPC-System-Simple-1.26>gmake
cp lib/IPC/System/Simple.pm blib\lib\IPC\System\Simple.pm

C:\home\sunlight\IPC-System-Simple-1.26>prove -lv t\04_capture.t
t\04_capture.t ..
1..12
ok 1 - use IPC::System::Simple;
(hangs)

Thank you,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.