system command in perl - prompt does not return back - window

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Selva123
    New Member
    • May 2010
    • 10

    #1

    system command in perl - prompt does not return back - window

    Hi All,
    Greetings. May be simple issue but your help sought.
    I am executing the system command like
    $res=system("no tepad.exe"); thro a perl file named aa.pl.

    At command prompt - when I enter
    perl aa.pl , I could see that notepad was opened but the control - I say as prompt ( in windows) does not return back.
    It looks like perl response is hanging.
    I have to stop the precess with ctrl+c

    Any idea ??
    Envn - Windows XP
    This is perl, v5.8.9 built for MSWin32-x86-multi-thread
    edit reply report
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    The system function will block until the executed command completes, which in this case is when you close/exit notepad.

    Please read: `perldoc -f system` http://perldoc.perl.org/functions/system.html

    If you want to create a detached process, you could use the Win32::Process module.

    Comment

    • Chendil
      New Member
      • Mar 2010
      • 6

      #3
      Originally posted by Selva123
      Hi All,
      Greetings. May be simple issue but your help sought.
      I am executing the system command like
      $res=system("no tepad.exe"); thro a perl file named aa.pl.

      At command prompt - when I enter
      perl aa.pl , I could see that notepad was opened but the control - I say as prompt ( in windows) does not return back.
      It looks like perl response is hanging.
      I have to stop the precess with ctrl+c

      Any idea ??
      Envn - Windows XP
      This is perl, v5.8.9 built for MSWin32-x86-multi-thread
      edit reply report
      You can use the exec command to create a detached process.

      Code:
      exec("notepad.exe")

      Comment

      Working...