Skip Menu |

This queue is for tickets about the Win32-Process CPAN distribution.

Report information
The Basics
Id: 35941
Status: rejected
Priority: 0/
Queue: Win32-Process

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

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Can not redirect stderr and stdout for new process to file
Win32::Process::Create( $processObj, $^X, $command, 0, IDLE_PRIORITY_CLASS, $INSTDIR ) where $command is 'perl -e "print 'test'; warn 'error'; " > output.file Show quoted text
2>error.file
NOTICE: that I run new process from script which has no its own STDOUT and STDERR. Those filehandles are closed
I/O redirection on the commandline is handled by the shell, not the CreateProcess() function. At the Perl level, system($cmd) will scan $cmd for the presence of any shell meta-characters, like '<', '>', '|', '%' and maybe others I currently don't remember. If it detects any of those, then it starts the process as "cmd.exe /c $cmd". Win32::Process is a low level interface to the Win32 CreateProcess() API, so I don't think it should do this type of commandline rewriting; it should be the caller's job to do that. If you don't want to start the subprocess via cmd.exe then you could also re-open STDOUT and STDERR in your Perl process and set the "inherit" parameter (the one after $command) to a true value so that your new process inherits the file handles: Win32::Process::Create( $processObj, $^X, $command, 1, IDLE_PRIORITY_CLASS, $INSTDIR )