From: Gurusamy Sarathy Date: Thu, 12 Jul 2001 15:50:40 +0000 (+0000) Subject: fix for failing fork.t#12 on windows (win32_execvp() tweak in X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ba6ce41c4496f483b5c1c88f4c612fa41f9a2e9f;p=p5sagit%2Fp5-mst-13.2.git fix for failing fork.t#12 on windows (win32_execvp() tweak in change#11300 needs to return the status of failed win32_spawnvp()) fix various open.pm bugs: '\0' isn't the same as "\0", so it wasn't splitting correctly; remove unused variables; 'require' at run time rather than 'use' at compile time for I18N::Langinfo, since it isn't everyware p4raw-link: @11300 on //depot/perl: a52054cddb558e8fac6bc289e7eb6b2720470b9d p4raw-id: //depot/perl@11310 --- diff --git a/lib/open.pm b/lib/open.pm index a42f623..441fc8c 100644 --- a/lib/open.pm +++ b/lib/open.pm @@ -10,9 +10,13 @@ sub in_locale { $^H & $locale::hint_bits } sub _get_locale_encoding { unless (defined $locale_encoding) { - eval { use I18N::Langinfo qw(langinfo CODESET) }; + eval { + # I18N::Langinfo isn't available everywhere + require I18N::Langinfo; + I18N::Langinfo->import('langinfo', 'CODESET'); + }; unless ($@) { - $locale_encoding = langinfo(CODESET); + $locale_encoding = langinfo(CODESET()); } my $country_language; if (not $locale_encoding && in_locale()) { @@ -49,9 +53,7 @@ sub import { my ($class,@args) = @_; croak("`use open' needs explicit list of disciplines") unless @args; $^H |= $open::hint_bits; - my ($in,$out) = split(/\0/,(${^OPEN} || '\0')); - my @in = split(/\s+/,$in); - my @out = split(/\s+/,$out); + my ($in,$out) = split(/\0/,(${^OPEN} || "\0"), -1); while (@args) { my $type = shift(@args); my $discp = shift(@args); diff --git a/win32/win32.c b/win32/win32.c index a0ebe03..5f4a177 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -3363,8 +3363,13 @@ win32_execvp(const char *cmdname, const char *const *argv) /* if this is a pseudo-forked child, we just want to spawn * the new program, and return */ if (w32_pseudo_id) { - my_exit(win32_spawnvp(P_WAIT, cmdname, (char *const *)argv)); - return 0; + int status = win32_spawnvp(P_WAIT, cmdname, (char *const *)argv); + if (status != -1) { + my_exit(status); + return 0; + } + else + return status; } #endif return execvp(cmdname, (char *const *)argv);