Skip to content

Commit 36ed033

Browse files
committed
Fix reporting of Win32::Process::Create() errors.
Per its documentation, it reports via GetLastError(), not $!.
1 parent 8491dfe commit 36ed033

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Makefile.PL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if ( $^O ne 'MSWin32' ) {
1616
}
1717
}
1818
else {
19-
$PREREQ_PM{'Win32'} = '0.27'; # for CSIDL_SYSTEM
19+
$PREREQ_PM{'Win32'} = '0.27';
2020
$PREREQ_PM{'Win32::Process'} = '0.14';
2121
$PREREQ_PM{'Win32::ShellQuote'} = 0;
2222
$PREREQ_PM{'Win32API::File'} = '0.0901';

lib/IPC/Run/Win32Helper.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,12 @@ sub win32_spawn {
523523
1, ## Inherit handles
524524
0, ## Inherit parent priortiy class. Was NORMAL_PRIORITY_CLASS
525525
".",
526-
) or croak "$!: Win32::Process::Create()";
526+
)
527+
or do {
528+
my $err = Win32::FormatMessage( Win32::GetLastError() );
529+
$err =~ s/\r?\n$//s;
530+
croak "$err: Win32::Process::Create()";
531+
};
527532

528533
for my $orig_fd ( keys %saved ) {
529534
IPC::Run::_dup2_rudely( $saved{$orig_fd}, $orig_fd );

0 commit comments

Comments
 (0)