in reply to Redirecting Output From Command Line in Threads
By the way, you shouldn't really need a shell to do this redirection for you. The C/C++ Win32 API CreateProcess has a struct within it which includes handles for stdin, stdout and stderr of the child process. It is a great shame that the implementor of Win32::Process::Create chose to omit these.#!/usr/bin/perl use strict; use Win32; use Win32::Process; my $ProcessObj; my $perl_command = ''; print "Starting thread logging test\n"; $perl_command = "$ENV{comspec} /c C:\\perl\\bin\\perl.exe C:\\output_t +est.pl >MyLog.txt 2>&1"; print "\n$perl_command\n"; my $result = Win32::Process::Create($ProcessObj,$ENV{comspec},$perl_co +mmand,1,CREATE_NO_WINDOW,"."); if ($result == 0) { die "Error: ",Win32::FormatMessage( Win32::GetLastError() ),"\n"; } print "Thread logging test completed\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Redirecting Output From Command Line in Threads
by CKCJim (Beadle) on Feb 02, 2011 at 14:48 UTC |