-
Notifications
You must be signed in to change notification settings - Fork 29.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: build task does not appear to terminate until user hits return in terminal #37846
Comments
@Tyriar the task system doesn't do anything special here. I listen for corresponding events on the terminal. Does this ring a bell for you? Could there be a timing issue with listeners in the terminal so that the task runner never receives the event. |
@gwk when this happens are the corresponding processes still alive (e.g. the bash executing the build.sh). And the tasks.json file you are using looks a little wired as will since you are actually executing a shell command. It should look like this:
|
@Tyriar this sounds very similar to #32276 (comment). Can you please have a look? |
@dbaeumer I just verified that the task process does terminate according to |
@gwk thanks for the info. |
...PS: I also have the impression that I'm only seeing this problem since very recently, but I am not entirely sure. May be it's related to the latest MacOS Beta? (I only updated about 2 days ago) |
The terminal system for some reason thinks the process didn't finish correctly. Not sure why hitting a key makes the terminal move to its final state. @Tyriar The message Can you please investigate and see why the terminal doesn't work as expected. |
Btw, I just noticed that the official Microsoft C# extension has the same problem on MacOS with the automatically created tasks.json. When running a build with |
@dbaeumer I can't reproduce this with the |
@gwk and I are both on the MacOS 10.13.2 Beta, may be that's the culprit? Since it also happens with .NET Core development and the official C# plugin on the normal 1.18.0 VSCode version I would expect many more bug reports otherwise... I just tested with Typescript and get the same behaviour, even without a task.json file (just a tsconfig.json). On I select "build", and only this line is printed in the terminal panel:
Starting another build gives me the dropdown that the task is already active. Pressing a key in the terminal panel prints this:
...and the task is detected as finished only then. |
Thanks, I can reproduce it on MacOS 10.13.2 Beta (17C76a). In the failure case: node-pty is waiting for 'close' on the terminal object, but that only comes after a key press triggered an 'error' event on the socket.
In the success case: node-pty also waits for 'close' at the same location and in this case that is triggered through the socket's 'close'. Not sure what could cause this. |
@chrmarti thanks for the investigation. Given that this only happens on a Beta of the Mac OS I would not do anything for a recovery build given the above analysis. |
Curious, have we verified that this does not happen anywhere except the recent betas? I don't have that ability at the moment. |
Yes, @chrmarti was not able to reproduce it on a non beta release but was on the beta 10.13.2. Since we only got reports on the Beta it is plausible to assume it doesn't exist on non beta version. |
OK. Just checked and the problem remains for macOS beta 4 (17C79a). |
I'm experiencing the same problem, macOS 10.13.2 (now released), VS Code 1.18.1. |
I can confirm and localize the issue to macOS 10.13.2. Upon installing that update I immediately began to experience this issue. |
Aaaand I'm back! Starting to look into it now, I upgraded to 10.13.2 and can reproduce. |
I got the same problem on 10.13.2. |
While I can consistent repro in VS Code, I'm having a bit of trouble reproducing in just node-pty. I had it happening a few times in a row (socket not closing), but then it just started working consistently again 😕 |
Here's a summary of what's happening. libuv fires this callback when the process has an exit code, the callback is set here. That callback is called https://github.com/chjj/pty.js/blob/fe63a412574f45ee6bb6d8fab4a5c102107b5201/lib/pty.js#L108-L117 The problem occurs because it goes into the It's also interesting to note that often (not always) when the socket is closed properly it will close before the My proposed solution is to add a 1 second timeout for the |
As reported in #39883 it can also happen when running |
Upstream issue: microsoft/node-pty#163 |
Cherry picked to |
@Tyriar thanks for looking into this! |
The fix appears to work in the current insider build, many thanks :) |
Also for me. Thank's |
Steps to Reproduce:
.vscode/tasks.json
:build.sh
with executable permissions and contents:The task will print done and presumably terminate. However the VSCode terminal window will not show it as terminated, and if I press the "build" keybinding again I get "The task 'typecheck-current (vscode-task-unterminated)' is already active. To terminate it use
Terminate Task...
from the Tasks menu." However if I press return in the integrated terminal then I will immediately get the expected "Terminal will be reused by tasks, press any key to close it."If you remove the
sleep 2
then the problem becomes very hard to reproduce. I have occasionally had difficulty reproducing it with the sleep, but by changing the sleep duration to a larger value I can usually trigger the bug. This makes me think that the problem is due to a change in the subprocess polling or something similar.This regression occurred in the last few days. It is very annoying because now I have to click on the terminal and hit return after every type check.
Reproduces without extensions: Yes
The text was updated successfully, but these errors were encountered: