I'm seeing an issue with running a subprocess in an async command.
When I run the extension under Windows, the subprocess will hang (for most commands).
(I tried to reproduce this using the json extension example and it happens there as well - you can just modify one of the async example commands to the code below).
The async command might look like this:
If the function is not async, it will work ok - but I need those commands to be async as they might take a long time to run.
In my case, I need to start a cli tool, in this case, it's python based but I don't think python is the only issue here (and I can't load this tool as a package so it needs to run as a process)
You can see in the code above that just checking the python version works, but running an actual script/command will hang (the python process starts but does nothing, until it gets released by some event/action when using vscode - things like switching views, clicking on some buttons, etc)
The output size is not relevant (I saw some issues online about using PIPEs and the output size but in this case, the code doesn't even start running, so this is not the issue)
Also tried with Popen but it's the same
Using python 3.8+ (but observed on 3.6,3.7 as well)
Did anyone encounter similar things or have any clue as to what might cause this? I'd rather keep this part on the server side instead of implementing it on the client side...
seems like adding PIPE to the stdin solved it.
proc = subprocess.run(
[sys.executable, '-c', 'print("aaaa")'],
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE
)
I'm seeing an issue with running a subprocess in an async command. When I run the extension under Windows, the subprocess will hang (for most commands).
(I tried to reproduce this using the json extension example and it happens there as well - you can just modify one of the async example commands to the code below). The async command might look like this:
Observations:
Did anyone encounter similar things or have any clue as to what might cause this? I'd rather keep this part on the server side instead of implementing it on the client side...