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

Exiting code doesn't ask to terminate running task #35643

Closed
bisaga opened this Issue Oct 5, 2017 · 8 comments

Comments

Projects
None yet
4 participants
@bisaga
Copy link

bisaga commented Oct 5, 2017

  • VSCode Version: Code 1.17.0 (be377c0, 2017-10-04T23:45:46.804Z)
  • OS Version: Windows_NT x64 10.0.15063
  • Extensions:
Extension Author (truncated) Version
ng-template Ang 0.1.7
vscode-eslint dba 1.3.2
githistory don 0.2.3
gitlens eam 5.4.1
tslint eg2 1.0.9
vscode-npm-script eg2 0.2.1
Angular2 joh 2.7.0
debugger-for-chrome msj 3.3.1

Steps to Reproduce:

  1. Create script to run server in package.json
    "scripts": {
    "server": "tsc --watch | nodemon --inspect --watch dist"
    },

  2. Create task (using the 2.0.0. compatibility version) and run "server" command which will run corresponding script with node and tsc processes.
    {
    "version": "2.0.0",
    "type": "process",
    "tasks": [
    {
    "type": "npm",
    "script": "server",
    "problemMatcher": [],
    "isBackground": true,
    "promptOnClose": true,
    "presentation": {
    "echo": true,
    "reveal": "always",
    "focus": false,
    "panel": "new"
    }
    }

  3. Take "File/Exit" , the code editor close without asking to terminate running task, all node instances remain running and must be killed from the task manager.

Workaround :

If you create task with the 0.1.0 standard compatibility, everything works as expected. The command is successfully ran and on the exit, editor ask I you wish to terminate running task. If you choose Yes, all node instances and tsc in the "watch" state are successfully terminated.
{
"version": "0.1.0",
"isShellCommand": false,
"showOutput": "always",
"tasks": [
{
"taskName": "run server",
"showOutput": "always",
"command": "npm",
"args": [
"run",
"server"
]
},

Reproduces without extensions: Yes
Reproduces in 32bit and 64bit version on windows 10

@vscodebot vscodebot bot added the tasks label Oct 5, 2017

@dbaeumer dbaeumer added this to the October 2017 milestone Oct 6, 2017

@dbaeumer

This comment has been minimized.

Copy link
Member

dbaeumer commented Oct 24, 2017

This is caused by an unlucky event order which is now hitting since the task service got more lazy. Since the task service now registers after the terminal service I don't execute the code path. I either need better control over these listeners order or the terminal service needs to expose a life cycle event.

@dbaeumer

This comment has been minimized.

Copy link
Member

dbaeumer commented Oct 27, 2017

The terminal does have support to confirm on Exit. You can until we have the right solution in place use "terminal.integrated.confirmOnExit": true

@dbaeumer dbaeumer modified the milestones: October 2017, On Deck Oct 27, 2017

@bisaga

This comment has been minimized.

Copy link
Author

bisaga commented Oct 27, 2017

At the exit the program now ask if you want to terminate 2 active terminal sessions ... The sessions are maybe terminated, but started node session remains started.

Anyway, with the terminate dialog, at least you can cancel the dialog and terminate task manually before exiting.

I will stick with the original workaround for now and use old version of the task runner.

@bisaga bisaga closed this Oct 27, 2017

@bisaga bisaga reopened this Oct 27, 2017

@dbaeumer

This comment has been minimized.

Copy link
Member

dbaeumer commented Nov 8, 2017

See #36845

@dbaeumer dbaeumer added the bug label Nov 20, 2017

@liudonghua123

This comment has been minimized.

Copy link

liudonghua123 commented Sep 14, 2018

@dbaeumer I tried to set "terminal.integrated.confirmOnExit": true in my user's settings. But it did not work as expected.

@dbaeumer

This comment has been minimized.

Copy link
Member

dbaeumer commented Sep 18, 2018

This works for me:

capture

Any additional steps how to reproduce what you are seeing

@alexr00

This comment has been minimized.

Copy link
Member

alexr00 commented Jan 4, 2019

I tried out "terminal.integrated.confirmOnExit" and it worked as expected. The issue mentioned where an extra process sticks around was fixed, so please let me know if you're seeing that still. Having a separate confirm on exit setting for tasks, or having a per task way to configure that is covered by #36845.

@alexr00 alexr00 added the *duplicate label Jan 4, 2019

@vscodebot

This comment has been minimized.

Copy link

vscodebot bot commented Jan 4, 2019

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this Jan 4, 2019

@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 18, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.