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