Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Forking an operative terminal

by Anonymous Monk
on Dec 31, 2012 at 19:03 UTC ( #1011089=note: print w/replies, xml ) Need Help??


in reply to Re^2: Forking an operative terminal
in thread Forking an operative terminal

You can get rid of the defunct processes by setting $SIG{CHLD} = 'IGNORE' in the parent. Also, you should use sh -c instead of bash -c in "bash -c '$command; bash'", since only sh is guaranteed to exist.

And the user's shell can be found with this piece of code:

my ($shell, $uid); while (($uid, $shell) = (getpwent)[2,8]) { last if $uid == $<; } say $shell;

Replies are listed 'Best First'.
Re^4: Forking an operative terminal
by Anonymous Monk on Dec 31, 2012 at 19:06 UTC
Re^4: Forking an operative terminal
by perlgrim (Initiate) on Jan 01, 2013 at 12:13 UTC

    Fine, I was trying to place an 'exit' into the exec to solve the problem, but the signal handler worked perfectly and sent the zombies back to their niches. As well as the code for user shell determination. Thanks again, your Wisdom.

    I also want to apologize because now I realize that my question concerned the shell and OS, not perl. Happy New Year to all the Monastery.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011089]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2018-08-19 02:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (186 votes). Check out past polls.

    Notices?