Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: How to close command prompts opened with perl script after execution that script

by ig (Vicar)
on Aug 07, 2012 at 05:06 UTC ( #985884=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How to close command prompts opened with perl script after execution that script
in thread How to close command prompts opened with perl script after execution that script

That I don't know.

Several options come to mind:

  • Implement the required functions in Perl so I don't have to call a bunch of other executables
  • Run each command separately (system, backticks or whatever), reading output back into perl, then present the output as appropriate, rather than trying to manage a bunch of separate command windows and processes running cmd.exe
  • Compose a batch file then run it
  • Try to establish a pipe to STDIN of cmd.exe and feed it commands, but then probably need something like IPC3::Open and Expect (but maybe not Expect itself on Windows - I don't know if it works there) and it quickly gets more complicated.

Having a *nix background, I don't much like the Windows way of doing process management. I find they make simple things, like process management and IPC very hard to do. For example, I still haven't found a simple way to get unbuffered I/O between a parent process and its child, or do anything like what process groups make easy on *nix. Being lazy, I do my best to avoid such issues. But this is my fault - probably not something you should emulate.


Comment on Re^3: How to close command prompts opened with perl script after execution that script
Select or Download Code
Re^4: How to close command prompts opened with perl script after execution that script
by snreddy_gopu (Novice) on Aug 07, 2012 at 09:15 UTC
    Thanks for your information ig. Is it possible to open duplicate session in unix using Perl?

      I'm not sure what you mean by "duplicate session". You can start multiple processes and communicate with them. See perlipc for some of the options.

Re^4: How to close command prompts opened with perl script after execution that script
by snreddy_gopu (Novice) on Aug 07, 2012 at 10:52 UTC
    is there any way to capture the output in that newly opened command prompt.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2014-07-13 23:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (252 votes), past polls