Debian Codegraph @

src/tests/hold-stdin

raw
1 #!/usr/bin/env perl
2
3 #
4 # The sole function of this script is to provide a stdin that doesn't
5 # read data or return EOF to its children. If there's a clean,
6 # portable, not-Perl way to do this, then that should replace this.
7 #
8 use warnings;
9 use strict;
10
11 my $pid = open(my $fh, "|-", @ARGV) or die;
12 waitpid($pid, 0) == $pid or die;
13 my $rc;
14 if ($? == 0) {
15 $rc = 0;
16 } elsif ($? >= 256) {
17 $rc = $? >> 8;
18 } else {
19 $rc = ($? & 127) | 128;
20 }
21 exit $rc;