develooper Front page | perl.perl5.porters | Postings from March 2006

Re: [perl #38748] qx seems to loose the subpr. way for print /dev/tty

Thread Previous | Thread Next
From:
Dominic Dunlop
Date:
March 17, 2006 07:04
Subject:
Re: [perl #38748] qx seems to loose the subpr. way for print /dev/tty
Message ID:
5B28BEF4-8754-42B9-BE1F-1256860444D9@mac.com
On 2006–03–17, at 09:40, ende (via RT) wrote:

> I send messages through /dev/tty with
>
> 	exec echo >/dev/tty
>
> in a tcl script that is called from a Perl script.
>
> The Perl script is on forever with a loop, allowing me
> a more easy control of both the Tcl script and the frequency
> and actions I want the daemon do each 10 minutes.

Can you make a short script (or pair of scripts) in pure Perl that  
show the problem? I ask because, if the process really is a daemon,  
it should not have a controlling terminal, and so /dev/tty should not  
be openable at all (not even once). Here's an example on Mac OS X  
(your platform -- basically BSD-ish):

$ perl -MPOSIX=setsid -lwe 'unless (fork) {setsid; qx(tty > /dev/ 
tty); sleep 300}'
sh: line 1: /dev/tty: Device not configured

and the same on PPC Linux:

$ perl -MPOSIX=setsid -lwe 'unless (fork) {setsid; qx(tty > /dev/ 
tty); sleep 300}'
sh: /dev/tty: No such device or address

(In both cases, we are seeing a complaint sent by the shell to  
standard error, which is still open, and which is not captured by qx().)
-- 
Dominic Dunlop


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About