Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Perl migration hp-ux -> Linux ( perlport, File::Spec->devnull )

by vccs (Initiate)
on Aug 14, 2015 at 11:03 UTC ( [id://1138562]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl migration hp-ux -> Linux ( perlport, File::Spec->devnull )
in thread Perl migration hp-ux -> Linux

I changed the code to
use DBI; use FileHandle; use rf; use File::Spec; use IO::Socket; use POSIX qw(setsid); sub get_msg_id_and_type; sub REAP { 1 until (-1 == waitpid(-1, WNOHANG)); $SIG{CHLD} = \&REAP; } $SIG{CHLD} = \&REAP; #$devnull = File::Spec->devnull(); open STDIN, '>/dev/null' || die "Can't read /dev/null: $!"; #open STDOUT, '>/dev/null' || die "Can't write to $prout: $!"; open STDOUT, File::Spec->devnull() || die "Can't write to $prout: $ +!"; open STDERR, '>>/dev/null' || die "Can't write to $prerr: $!"; defined(my $pid = fork) || die "Can't fork: $!"; exit if $pid;
and it works. Is it because the /dev/null behaviour is different on HP-UX and LINUX?
  • Comment on Re^2: Perl migration hp-ux -> Linux ( perlport, File::Spec->devnull )
  • Download Code

Replies are listed 'Best First'.
Re^3: Perl migration hp-ux -> Linux ( perlport, File::Spec->devnull )
by anonymized user 468275 (Curate) on Aug 14, 2015 at 11:27 UTC
    Another contributory factor might be that you are opening STDIN for output instead of input i.e. more normal would be:
    open STDIN, '/dev/null' || die "Can't read /dev/null: $!";

    One world, one people

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1138562]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-19 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found