Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: exec function does not return command prompt

by casman46 (Initiate)
on Aug 18, 2014 at 12:42 UTC ( [id://1097844]=note: print w/replies, xml ) Need Help??


in reply to Re: exec function does not return command prompt
in thread exec function does not return command prompt

Crackers2: Thank you for your reply to my question. It appears that I do not understand how the fork function works. Nevertheless, since both test1.pl and test2.pl do exit, shouldn't I see a command prompt at the conclusion of each one?

  • Comment on Re^2: exec function does not return command prompt

Replies are listed 'Best First'.
Re^3: exec function does not return command prompt
by Crackers2 (Parson) on Aug 19, 2014 at 15:03 UTC

    No. That's not how the shell works. Either it will wait for both to exit before showing the (one) prompt, or it will show the prompt after a certain proces exits and finish the other one in the background; in that case you won't get a new prompt after the background one exits.

    I'm not exactly sure when it decides to keep stuff in the foreground or run them in the background.

    In your case I think it's running both in the foreground, but due to buffering the output from test2 just happens to show up after the prompt

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-26 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found