Programs blocking the current shell
Posted: 24 Jun 2016 09:30
I have run into something confusing. Some programs, when run from a batch program, seems to block forever, even after the program quits! I am then forced to close down the cmd window, Ctrl-C/Z/break do not work.
For me, this seems to be the case with Chrome. I don't know if it's the same with all versions, if it's just on my computer etc.
Note: this only happens when called from a bat file, when executed from command line only (3) and (6) freezes!
Here are the commands in test.bat I used to test this (the numbers are just for clarity, obviously, and I try one line per run by commenting out the rest):
Case (1): Chrome opens, and even though I close down Chrome, the cmd line is stuck!
Case (2): Same as 1
Case (3): Same as 1
Case (4): Stupid one, since I have spaces in the path it just fails, but...
Case (5): A new cmd window is opened, and nothing else happens (why is it like this?)
Case (6): A new cmd window is opened, Chome runs, the new window freezes even after exiting Chrome (at least the original window doesnt freeze)
Case (7): The only one that "works", but has many undesired effects (for one, the "invisible" process is most likely frozen, and second if I run something else than Chrome this way, e.g. a bat file, things turn quite strange (key input doesnt work etc)). And I want to be able to run anything with this method, not just Chrome or exe files.
I should also note that every second time when running Chrome this way, absolutely nothing happens! (i.e. Chrome does not run, so no freeze, but also no Chrome)
What is going on here? I am confused. Can anybody reproduce this?
For me, this seems to be the case with Chrome. I don't know if it's the same with all versions, if it's just on my computer etc.
Note: this only happens when called from a bat file, when executed from command line only (3) and (6) freezes!
Here are the commands in test.bat I used to test this (the numbers are just for clarity, obviously, and I try one line per run by commenting out the rest):
Code: Select all
::"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" (1)
::call "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" (2)
::cmd /C "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" (3)
::start C:\Program Files (x86)\Google\Chrome\Application\chrome.exe (4)
::start "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" (5)
::start cmd /C "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" (6)
start /B cmd /C "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" (7)
Case (1): Chrome opens, and even though I close down Chrome, the cmd line is stuck!
Case (2): Same as 1
Case (3): Same as 1
Case (4): Stupid one, since I have spaces in the path it just fails, but...
Case (5): A new cmd window is opened, and nothing else happens (why is it like this?)
Case (6): A new cmd window is opened, Chome runs, the new window freezes even after exiting Chrome (at least the original window doesnt freeze)
Case (7): The only one that "works", but has many undesired effects (for one, the "invisible" process is most likely frozen, and second if I run something else than Chrome this way, e.g. a bat file, things turn quite strange (key input doesnt work etc)). And I want to be able to run anything with this method, not just Chrome or exe files.
I should also note that every second time when running Chrome this way, absolutely nothing happens! (i.e. Chrome does not run, so no freeze, but also no Chrome)
What is going on here? I am confused. Can anybody reproduce this?