Re: Can't close STDIN/STDOUT/STDERR
by salva (Canon) on Feb 09, 2010 at 21:17 UTC
|
That message looks familiar to me ;-)
Well, anyway, it means that instead of a real system file handle, you are using a faked one, usually something derived from Tie::Handle that is not connected to a real file. Tied file handles work fine as long as you stay inside the Perl process but you can not pass them to new processes because they do not exists at the operative system level.
| [reply] |
|
|
I'm really confused... I think I need to close the ACTUAL STDOUT/in/err because I'm trying to run a CGI script that takes a very long time to process. I want the parent to return an HTML confirmation page after it waits 30 seconds (in case the child finishes quickly).
| [reply] |
|
|
| [reply] [d/l] [select] |
Re: Can't close STDIN/STDOUT/STDERR
by ikegami (Patriarch) on Feb 09, 2010 at 21:09 UTC
|
That message does not appear in the Perl distribution. Maybe if you told us what's producing it.
| [reply] |
|
|
Ah! It appears to originate from Net::OpenSSH. (Thanks Google)
Anyway, it's a fair warning. Programs expect to be provided a STDIN, STDOUT and STDERR, and you don't provide them. Don't close them. Instead, redirect them to /dev/null.
| [reply] [d/l] |
|
|
I tried that (redirect to /dev/null) and it broke my program... I'm not well-versed enough in Perl to know why. Could you give me an example of how I should do it?
| [reply] [d/l] |
|
|
|
|
|
|
|
|
|
} else {
#Child
die "cannot fork: $!" unless defined $child_pid;
close(READER) or die "can't close READER: $!";
close(STDIN) or die "can't close STDIN: $!";
close(STDOUT) or die "can't close STDOUT: $!";
close(STDERR) or die "can't close STDERR: $!";
| [reply] [d/l] |
|
|
I seriously doubt that code is issuing the error. One of those handles would have to use magic Google didn't find, or some Perl functions would have been replaced by some module Google didn't find. Neither are likely.
| [reply] |