CC: | garfieldnate [...] gmail.com |
Subject: | blocks if command reads <STDIN> (on Win32) |
This is related to rt#85428. If IPC::Cmd is used to run a Perl script which reads from <STDIN>, it blocks indefinitely. Here's a sample:
#test_ipc.pl
use IPC::Cmd;
print !!IPC::Cmd->can_capture_buffer; #prints 1
#$IPC::Cmd::USE_IPC_OPEN3 = 1; #doesn't change anything
#$IPC::Cmd::USE_IPC_RUN = 1; #doesn't change anything
#blocks forever
IPC::Cmd::run(
command => [ 'perl', 'foo.pl'],
verbose => 1,
);
#foo.pl
print 'hello!'; # prints nothing unless the following line is removed
$answer = <STDIN>;
Here's my config info (perl -V):
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32-x64-multi-thread
uname='Win32 strawberry-perl 5.18.1.1 #1 Tue Aug 13 17:18:28 2013 x64'
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fno-strict-aliasing -mms-bitfields',
optimize='-s -O2',
cppflags='-DWIN32'
ccversion='', gccversion='4.7.3', gccosandvers=''
intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long long', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='g++.exe', ldflags ='-s -L"C:\Users\Nathan\Desktop\strawberry-perl-5.18.1.1-64bit-portable\perl\lib\CORE" -L"C:\Users\Nathan\Desktop\strawberry-perl-5.18.1.1-64bit-portable\c\lib"'
libpth=C:\Users\Nathan\Desktop\strawberry-perl-5.18.1.1-64bit-portable\c\lib C:\Users\Nathan\Desktop\strawberry-perl-5.18.1.1-64bit-portable\c\x86_64-w64-mingw32\lib
libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
libc=, so=dll, useshrplib=true, libperl=libperl518.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-mdll -s -L"C:\Users\Nathan\Desktop\strawberry-perl-5.18.1.1-64bit-portable\perl\lib\CORE" -L"C:\Users\Nathan\Desktop\strawberry-perl-5.18.1.1-64bit-portable\c\lib"'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY
PERLIO_LAYERS PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_SAWAMPERSAND
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
Built under MSWin32
Compiled at Aug 13 2013 17:23:34
@INC:
C:/Users/Nathan/Desktop/strawberry-perl-5.18.1.1-64bit-portable/perl/site/lib/MSWin32-x64-multi-thread
C:/Users/Nathan/Desktop/strawberry-perl-5.18.1.1-64bit-portable/perl/site/lib
C:/Users/Nathan/Desktop/strawberry-perl-5.18.1.1-64bit-portable/perl/vendor/lib
C:/Users/Nathan/Desktop/strawberry-perl-5.18.1.1-64bit-portable/perl/lib
.