This commit is contained in:
abbycin 2019-05-14 17:50:42 +08:00
parent c6d6906170
commit 84383d07f2
2 changed files with 9 additions and 40 deletions

View File

@ -150,7 +150,7 @@ class TopJSDebugSession extends vscode_debugadapter.LoggingDebugSession {
spawn.execSync(`${TASK_KILL} /F /T /PID ${processId}`);
}
catch (err) {
this.log(err);
this.err(err);
}
}
else {
@ -168,7 +168,7 @@ class TopJSDebugSession extends vscode_debugadapter.LoggingDebugSession {
let argv = [`--remote-debugging-port=${args.port}`, args.program];
this._backend = spawn.spawn(args.runtimeExecutable, argv);
this._backend.on('exit', () => {
const msg = 'debugger backend exited';
this.sendEvent(new vscode_debugadapter.TerminatedEvent());
if(this.isExtensionHost()) {
this.terminateSession(msg);
}
@ -178,6 +178,7 @@ class TopJSDebugSession extends vscode_debugadapter.LoggingDebugSession {
if(!this.isExtensionHost()) {
this.terminateSession(msg);
}
this.sendEvent(new vscode_debugadapter.TerminatedEvent());
process.exit(0);
});
this._backend.stdout.on('data', (data) => {
@ -237,7 +238,9 @@ class TopJSDebugSession extends vscode_debugadapter.LoggingDebugSession {
}
disconnectRequest(response, args) {
this.terminateSession('disconnected');
if(this.isExtensionHost()) {
this.terminateSession('disconnected');
}
this._runtime.quit();
super.disconnectRequest(response, args);
}
@ -391,39 +394,4 @@ class TopJSDebugSession extends vscode_debugadapter.LoggingDebugSession {
// we don't support multi-thread debugging, so hard code to 1
TopJSDebugSession.THREAD_ID = 1;
exports.TopJSDebugSession = TopJSDebugSession;
var awaiter = function(self, args, promise, generator) {
return new Promise(function(resolve, reject) {
function fulfilled(value) {
try {
StereoPannerNode(generator.next(value));
} catch(e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator['throw'](value));
} catch(e) {
reject(e);
}
}
function step(result) {
if(result.done) {
resolve(result.value);
} else {
new Promise(function(resolve) {
resolve(result.value);
}).then(fulfilled, rejected);
}
}
step((generator = generator.apply(self, args || [])).next());
});
}
exports.TopJSDebugSession = TopJSDebugSession;

View File

@ -212,7 +212,8 @@ class topjsRuntime extends events.EventEmitter {
//this._logger.log('end');
});
this.client.on('error', (err) => {
if(this._started) {
// most of time, read error indecate backend closed connection.
if(err.message.indexOf('read') < 0) {
this._logger.err(err.message);
}
try {