Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add STDIN to tests #35

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions t/02_exit.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ if ($^O ne 'VMS') {
use IPC::System::Simple qw(run EXIT_ANY);
chdir("t"); # Ignore return, since we may already be in t/

#Close STDIN (and reopen to prevent warnings)
#If Perl is called with no arguments, it waits for input on STDIN.
close STDIN;
open STDIN, '<', '/dev/null';

run($perl_path,"exiter.pl",0);
ok(1,"Multi-arg implicit zero allowed");

Expand Down
5 changes: 5 additions & 0 deletions t/03_signal.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ use_ok("IPC::System::Simple","run");

chdir("t");

#Close STDIN (and reopen to prevent warnings)
#If Perl is called with no arguments, it waits for input on STDIN.
close STDIN;
open STDIN, '<', '/dev/null';

run([1],$perl_path,"signaler.pl",0);
ok(1);

Expand Down
5 changes: 5 additions & 0 deletions t/04_capture.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ my $output_exe = "$perl_path output.pl";
use_ok("IPC::System::Simple","capture");
chdir("t");

#Close STDIN (and reopen to prevent warnings)
#If Perl is called with no arguments, it waits for input on STDIN.
close STDIN;
open STDIN, '<', '/dev/null';

# Scalar capture

my $output = capture($output_exe);
Expand Down
5 changes: 5 additions & 0 deletions t/05_multi_capture.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ if ($^O ne 'VMS') {
use_ok("IPC::System::Simple","capture");
chdir("t");

#Close STDIN (and reopen to prevent warnings)
#If Perl is called with no arguments, it waits for input on STDIN.
close STDIN;
open STDIN, '<', '/dev/null';

# The tests below for $/ are left in, even though IPC::System::Simple
# never touches $/

Expand Down
5 changes: 5 additions & 0 deletions t/07_taint.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ use_ok("IPC::System::Simple","run","capture");

chdir("t"); # Ignore return, since we may already be in t/

#Close STDIN (and reopen to prevent warnings)
#If Perl is called with no arguments, it waits for input on STDIN.
close STDIN;
open STDIN, '<', '/dev/null';

my $taint = $0 . "foo"; # ."foo" to avoid zero length
ok(tainted($taint),"Sanity - executable name is tainted");

Expand Down
5 changes: 5 additions & 0 deletions t/08_core.t
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ use_ok("IPC::System::Simple","run");

chdir("t");

#Close STDIN (and reopen to prevent warnings)
#If Perl is called with no arguments, it waits for input on STDIN.
close STDIN;
open STDIN, '<', '/dev/null';

my $rlimit_success = setrlimit(RLIMIT_CORE, RLIM_INFINITY, RLIM_INFINITY);

SKIP: {
Expand Down
5 changes: 5 additions & 0 deletions t/09_system.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ if ($^O ne 'VMS') {
use IPC::System::Simple qw(system);
chdir("t"); # Ignore return, since we may already be in t/

#Close STDIN (and reopen to prevent warnings)
#If Perl is called with no arguments, it waits for input on STDIN.
close STDIN;
open STDIN, '<', '/dev/null';

system($perl_path,"exiter.pl",0);
ok(1,"Multi-arg system");

Expand Down
6 changes: 6 additions & 0 deletions t/11_newlines.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ if ($^O ne 'VMS') {
unless $perl_path =~ m/$Config{_exe}$/i;
}

chdir("t"); # Ignore return, since we may already be in t/
#Close STDIN (and reopen to prevent warnings)
#If Perl is called with no arguments, it waits for input on STDIN.
close STDIN;
open STDIN, '<', '/dev/null';

eval { run( "$perl_path -e1" ) };
is($@, "", 'Run works with single arg');

Expand Down
5 changes: 5 additions & 0 deletions t/12_systemx.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ if ($^O ne 'VMS') {

chdir("t"); # Ignore return, since we may already be in t/

#Close STDIN (and reopen to prevent warnings)
#If Perl is called with no arguments, it waits for input on STDIN.
close STDIN;
open STDIN, '<', '/dev/null';

my $exit_test = "$perl_path exiter.pl 0";

eval {
Expand Down
5 changes: 5 additions & 0 deletions t/win32.t
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ ok($raw_perl, "Have perl executables with and w/o extensions.");

chdir("t");

#Close STDIN (and reopen to prevent warnings)
#If Perl is called with no arguments, it waits for input on STDIN.
close STDIN;
open STDIN, '<', '/dev/null';

# Check for 16 and 32 bit returns.

foreach my $big_exitval (SMALL_EXIT, BIG_EXIT, HUGE_EXIT) {
Expand Down