in reply to Avoiding accidentally flock()'ing STDOUT
You might try using the -t file test operator, this should be able to tell you whether a handle is opened to TTY (and hence not flock()able) and not to a file:
print "Yow!" if -t STDOUT; open SAVOUT, '>&STDOUT'; close STDOUT; open STDOUT, '>stdout.txt'; print "Yow!" if -t STDOUT;
/J\
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Avoiding accidentally flock()'ing STDOUT
by shay (Beadle) on Aug 13, 2004 at 11:31 UTC |