tarlog / tarlog-plugins

Automatically exported from code.google.com/p/tarlog-plugins
10 stars 5 forks source link

Command-line switch for cmd.exe that solves the process management issue #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi! Sorry to beat on this issue. I did some further research and
experimentation. It turns out that a better overall command line would be:

Runtime.getRuntime().exec("cmd /c start cmd", null, new File(path));

With this command line you can remove the whole "Process.destroy()" bit
that you added for Issue 3 (sorry!!).

Two fixes here are:
1. Use the "/c" switch instead of the "/k" switch so that the parent cmd
shell (the one that executes "start") terminates immediately.

2. Pass the path as the cwd instead of on the command line (optional, but
simplifies the command line--you can use your discretion here). If you do
not want to use the 3-arg form of exec, then you still need to use the "/k"
switch before the cd...i.e.: 
   "cmd /c start cmd /k \"cd /d" + path + "\""

Thanks much!
Dave

Original issue reported on code.google.com by dcit...@gmail.com on 27 Aug 2008 at 4:33

GoogleCodeExporter commented 9 years ago
Weird! I gave a try to the "cmd /c start cmd /k \"cd /d" + path + "\"" solution
yesterday, and somehow it didn't work. May be I mixed it with some other 
arguments in
the command line and this was the reason it didn't work...

Original comment by tarlog on 27 Aug 2008 at 5:01

GoogleCodeExporter commented 9 years ago
Huh, strange. I see that you've made the code change now. Do you find that it's
working correctly?

Original comment by dcit...@gmail.com on 28 Aug 2008 at 5:23

GoogleCodeExporter commented 9 years ago
Yep. I did and it works fine now.
I'll replace the distribution as soon as I have time.

Original comment by tarlog on 28 Aug 2008 at 6:15

GoogleCodeExporter commented 9 years ago
Great! Thanks!

Original comment by dcit...@gmail.com on 28 Aug 2008 at 2:52

GoogleCodeExporter commented 9 years ago
Released! :)

Original comment by tarlog on 31 Aug 2008 at 3:05

GoogleCodeExporter commented 9 years ago

Original comment by tarlog on 13 Sep 2009 at 5:44