Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

wperl in cmd file not returning immediately

by Pascal666 (Scribe)
on Aug 28, 2009 at 07:26 UTC ( [id://791849]=perlquestion: print w/replies, xml ) Need Help??

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

Using file named sleep.pl containing only "sleep 10;", when I run "wperl sleep.pl" from the command line I get another prompt immediately (as expected). When the same command is run from a cmd file however, the cmd file waits for 10 seconds for wperl to finish before continuing. How do I get wperl in a cmd to return immediately? I am using ActivePerl-5.10.0.1005-MSWin32-x64-290470 on Vista sp2 x64.
  • Comment on wperl in cmd file not returning immediately

Replies are listed 'Best First'.
Re: wperl in cmd file not returning immediately
by ikegami (Patriarch) on Aug 31, 2009 at 19:21 UTC

    Batch files wait for GUI applications to terminate. The interactive shell does not. Replace

    wperl -e"sleep 10"
    with
    start wperl -e"sleep 10"

    To get the interactive behaviour in a batch file.

      Works perfectly now. Thank you.
Re: wperl in cmd file not returning immediately
by Anonymous Monk on Aug 28, 2009 at 08:16 UTC

      Is there a particular section of that man page you thought was relevant?

      wperl runs in the background just fine when executed from a command prompt. Completely rewriting a script to use Proc::Background should not be necessary.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-25 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found