Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Capture-Tiny CPAN distribution.

Report information
The Basics
Id: 71701
Status: open
Priority: 0/
Queue: Capture-Tiny

People
Owner: Nobody in particular
Requestors: PHILKIME [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.11
Fixed in: (no value)



The attached simple case doesn't capture STDERR in Windows. Seems ok on all other platforms. It's not clear to me if this is a Windows thing you can't do anything about? This is a minimal example of a general issue of not capturing STDERR from XS/external libs in windows.
Subject: test.pl
#!/usr/bin/perl use Capture::Tiny 'capture'; use File::Temp qw(tempfile); use Inline C; my ($stdout, $stderr) = capture { test_err() }; print "|$stderr|\n"; __END__ __C__ void test_err() { (void)fprintf (stderr, "ERROR"); }
Subject: Re: [rt.cpan.org #71701]
Date: Sat, 15 Oct 2011 14:00:30 -0400
To: bug-Capture-Tiny [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
On Sat, Oct 15, 2011 at 9:08 AM, Philip Kime via RT <bug-Capture-Tiny@rt.cpan.org> wrote: Show quoted text
> The attached simple case doesn't capture STDERR in Windows. Seems ok on all other platforms. > It's not clear to me if this is a Windows thing you can't do anything about? This is a minimal > example of a general issue of not capturing STDERR from XS/external libs in windows.
Thank you for the report. I'll look into it. Even if it can't be avoided, it will need to be added as a known issue. For the record, what version of Windows and what version of Perl did you use? Could you please attach the output of 'perl -V'? -- David
This is perl, v5.10.1 built for MSWin32-x86-multi-thread
Subject: perl.txt
Summary of my perl5 (revision 5 version 10 subversion 1) configuration: Platform: osname=MSWin32, osvers=5.2, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='C:/Perl/site/bin/gcc.exe', ccflags ='-DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields', optimize='-O2', cppflags='-DWIN32' ccversion='', gccversion='3.4.5 (mingw-vista special r3)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='C:\Perl\site\bin\g++.exe', ldflags ='-L"C:\Perl\lib\CORE"' libpth=\lib libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl510.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -L"C:\Perl\lib\CORE"' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_SITECUSTOMIZE Locally applied patches: ActivePerl Build 1008 [294165] 0abd0d78 disable non-unicode case insensitive trie matching 827da6a3 -t should only return TRUE for file handles connected to a TTY d956618 Make Term::ReadLine::findConsole fall back to STDIN if /dev/tty can't be opened Built under MSWin32 Compiled at Dec 9 2010 06:00:35 @INC: C:/Perl/site/lib C:/Perl/lib .
On Sat Oct 15 09:08:58 2011, PHILKIME wrote: Show quoted text
> The attached simple case doesn't capture STDERR in Windows. Seems ok > on all other platforms. > It's not clear to me if this is a Windows thing you can't do anything > about? This is a minimal > example of a general issue of not capturing STDERR from XS/external > libs in windows. >
If you add an fflush call after your fprintf, does it work? -- David
From: leosusanto [...] gmail.com
On Tue Feb 21 11:41:03 2012, DAGOLDEN wrote: Show quoted text
> On Sat Oct 15 09:08:58 2011, PHILKIME wrote:
> > The attached simple case doesn't capture STDERR in Windows. Seems ok > > on all other platforms. > > It's not clear to me if this is a Windows thing you can't do anything > > about? This is a minimal > > example of a general issue of not capturing STDERR from XS/external > > libs in windows. > >
> > If you add an fflush call after your fprintf, does it work? > > -- David >
It doesn't work. use Inline; Inline->bind( C => << 'CCODE' ); void test_inline1() { printf("test_inline1"); } void test_inline3() { printf("test_inline3"); } void test_inline2() { fprintf(stdout, "test_inline2"); fflush(stdout); } CCODE test_inline1(); test_inline2(); test_inline3(); __RESULT__ test_inline1