Skip to content
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

ITerminalInstance.onDisposed can fire multiple times for a single instance #19026

Closed
dbaeumer opened this issue Jan 23, 2017 · 6 comments
Closed
Assignees
Labels
terminal Integrated terminal issues
Milestone

Comments

@dbaeumer
Copy link
Member

Steps to reproduce:

  • create a terminal with a running process
  • dispose the terminal by pressing the garbage bin button

Observe:

you get ITerminalInstance.onDisposed() but no ITerminalInstance.onExit(). Since the process exists as well I would expect to first receive the onExit and then the onDisposed event.

@dbaeumer dbaeumer added the terminal Integrated terminal issues label Jan 23, 2017
@dbaeumer
Copy link
Member Author

@Tyriar this one would be important for me for the January milestone.

@Tyriar
Copy link
Member

Tyriar commented Jan 23, 2017

I'm seeing onExit fire, it's just giving a null exitCode? I added this:

		terminalInstance.onExit(code => {
			console.log('onExit: ' + code);
		});

to TerminalService.createInstance and hit the trash button and see onExit: null in output?

There is this in TerminalInstance.dispose which should fire the listener.

		if (this._process) {
			if (this._process.connected) {
				this._process.kill();
			}
			this._process = null;
		}

I can see why this would not happen when you call reuseTerminal though? Is that the case you mean? What platform are you on if not?

@Tyriar Tyriar added this to the January 2017 milestone Jan 23, 2017
@dbaeumer
Copy link
Member Author

Happens for me under Windows even if the terminal is created the first time. Here is my tasks.json

{
    "version": "0.1.0",
    "_runner": "terminal",
    "tasks": [
        {
            "taskName": "tsc",
            "command": "tsc -w",
            "isShellCommand": true,
            "isBackground": true,
            "problemMatcher": "$tsc-watch"
        }
    ]
}

Mt tsconfig.json

{
	"compilerOptions": {
		"module": "commonjs",
		"sourceMap": true,
		"target": "es6"
	}
}

and a ts file with some errors

Observe: breakpoint in dispose is hit but none of the exit callbacks are hit.

@dbaeumer
Copy link
Member Author

I added a console.log statement and that is printed. Looks like a debugger problem.

@dbaeumer
Copy link
Member Author

OK. Adding console.log statements only I get the following sequence:

Dispose called terminalTaskSystem.ts:412
Dispose called terminalTaskSystem.ts:412
Exit called terminalTaskSystem.ts:257

So I do get the exit but I do get dispose twice. Changed title.

@dbaeumer
Copy link
Member Author

Not critical for January anymore since I protected myself against the second dispose call.

@Tyriar Tyriar modified the milestones: February 2017, January 2017 Jan 24, 2017
@Tyriar Tyriar closed this as completed in 9860dc4 Feb 15, 2017
@Tyriar Tyriar changed the title ITerminalInstance doesn't sent onExit if terminal is disposed with running process ITerminalInstance.onDisposed can fire multiple times for a single instance Feb 15, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
terminal Integrated terminal issues
Projects
None yet
Development

No branches or pull requests

2 participants