summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2004-12-06 14:39:59 +0000
committerNicholas Clark <nick@ccl4.org>2004-12-06 14:39:59 +0000
commit9a731dbde319d4ad89a923cac3bdf4af379645dc (patch)
treee7c884ee0ea0b97af13311fc0043c6d30537e3a4
parentd9a22066ef928f4f3759cbd5455cf5ca596af7b4 (diff)
downloadperl-9a731dbde319d4ad89a923cac3bdf4af379645dc.tar.gz
sanity check the arguments to runperl(), to try to avoid it
hanging waiting on STDIN for a script. p4raw-id: //depot/perl@23615
-rw-r--r--t/test.pl8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/test.pl b/t/test.pl
index a35eb83693..e2edccb4f8 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -412,6 +412,12 @@ sub _create_runperl { # Create the string to qx in runperl().
}
} elsif (defined $args{progfile}) {
$runperl .= qq( "$args{progfile}");
+ } else {
+ # You probaby didn't want to be sucking in from the upstream stdin
+ die "test.pl:runperl(): none of prog, progs, progfile, args, "
+ . " switches or stdin specified"
+ unless defined $args{args} or defined $args{switches}
+ or defined $args{stdin};
}
if (defined $args{stdin}) {
# so we don't try to put literal newlines and crs onto the
@@ -455,6 +461,8 @@ sub _create_runperl { # Create the string to qx in runperl().
}
sub runperl {
+ die "test.pl:runperl() does not take a hashref"
+ if ref $_[0] and ref $_[0] eq 'HASH';
my $runperl = &_create_runperl;
my $result = `$runperl`;
$result =~ s/\n\n/\n/ if $is_vms; # XXX pipes sometimes double these