summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2001-07-12 15:50:40 +0000
committerGurusamy Sarathy <gsar@cpan.org>2001-07-12 15:50:40 +0000
commitba6ce41c4496f483b5c1c88f4c612fa41f9a2e9f (patch)
treea51fcf7a9aa1f3b1871c9ec9d4b7f52c4251b113
parent70c4e4ee7b5c3958814603143a4843e0ec76b625 (diff)
downloadperl-ba6ce41c4496f483b5c1c88f4c612fa41f9a2e9f.tar.gz
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
-rw-r--r--lib/open.pm12
-rw-r--r--win32/win32.c9
2 files changed, 14 insertions, 7 deletions
diff --git a/lib/open.pm b/lib/open.pm
index a42f62353b..441fc8cf60 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 a0ebe03d12..5f4a177e06 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);