Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Changing tty's in perl

by falken (Initiate)
on Aug 11, 2001 at 02:50 UTC ( [id://104062]=perlquestion: print w/replies, xml ) Need Help??

falken has asked for the wisdom of the Perl Monks concerning the following question:

I have an application that i'm executing with in perl with the system("cmd &") call. For some reason it is requiring it have STDIN. I have closed all STDIN, STDOUT STDERR fd's and tried the POSIX setsid(). All with no luck. Is there anyway in perl I can switch the tty with posix functions and (or) fool the application into a another non-used tty?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: Changing tty's in perl
by kjherron (Pilgrim) on Aug 11, 2001 at 23:55 UTC
    The posix way to obtain a new controlling tty is to first get rid of the old one, as you've outlined, and then open a new one; the first one opened becomes the new controlling tty. You can't use "/dev/tty" for this purpose of course, you'd have to open a real tty device. These are /dev/pty*, /dev/console, and devices corresponding to actual serial ports.

    Is the program insisting on a tty, or just a valid stdin? Instead of just closing stdin/stdout/stderr you can try opening them to /dev/null, and see if that is sufficient. If it needs a tty, one can often use /dev/console.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://104062]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-03-29 12:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found