in reply to More pipe problems
Actually, the explanation behind this one is even simpler. You're opening a pipe to perl, with "non-existant_file" called as an argument. That pipe will succeed; perl will be opened, and subsequently exit, but the point is that the "open" call itself was successful -- you were able to open a handle to a perl process.
The cheap and easy way around this is to make sure that whatever you intend to open on a pipe is executable and has the shebang at the top, and omit the perl. e.g.:
#!/usr/bin/perl use strict; open (PIPE,"|non-existant_file") or die "Can't open pipe: $!"; print "hello"; sleep 5; print "goodbye";
As an aside, it doesn't even have to be perl inside the pipe for this to be a factor. This could just as easily have been a pipe to awk or gzip or foobarbazwhee with incorrect arguments -- as long as the right-hand side of the pipe is, in fact, invoked, open doesn't fail.
Spud Zeppelin * spud@spudzeppelin.com
|
|---|