View Single Post
Old 04-02-2013, 05:19 PM   #174
pjeby
.
pjeby began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Apr 2013
Device: Various
Lightbulb DETACHED_PROCESS flag needed for Windows console programs

Hi, just wanted to report an issue with v1.5.6 (really 1.5.3 and up) for running console programs and scripts (such as batch files or Python scripts) on Windows. Basically, the CreateProcess call that's currently in the plugin doesn't allow the launched programs to create a valid console and so their input and output don't actually work. The program runs (I think) but the window just flashes up and disappears.

So, I changed the CreateProcess call in the plugin to read:

CreateProcess(None, cmd_line, None, None, False, DETACHED_PROCESS, None, None, si)

and moved the DETACHED_PROCESS definition so it covers both branches of the if, and this fixed the problem for me.

(As a side note, it's a little annoying that I can't just directly invoke .py, .bat, or .ahk scripts from the plugin; I have to specify the interpreter (python, cmd.exe, autohotkey.exe, etc.) and then pass the script as an argument. It might be nice to be able to just specify the script and let Windows take care of running the interpreter. Apart from that, great plugin!)
pjeby is offline   Reply With Quote