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}`); spawn.execSync(`${TASK_KILL} /F /T /PID ${processId}`);
} }
catch (err) { catch (err) {
this.log(err); this.err(err);
} }
} }
else { else {
@ -168,7 +168,7 @@ class TopJSDebugSession extends vscode_debugadapter.LoggingDebugSession {
let argv = [`--remote-debugging-port=${args.port}`, args.program]; let argv = [`--remote-debugging-port=${args.port}`, args.program];
this._backend = spawn.spawn(args.runtimeExecutable, argv); this._backend = spawn.spawn(args.runtimeExecutable, argv);
this._backend.on('exit', () => { this._backend.on('exit', () => {
const msg = 'debugger backend exited'; this.sendEvent(new vscode_debugadapter.TerminatedEvent());
if(this.isExtensionHost()) { if(this.isExtensionHost()) {
this.terminateSession(msg); this.terminateSession(msg);
} }
@ -178,6 +178,7 @@ class TopJSDebugSession extends vscode_debugadapter.LoggingDebugSession {
if(!this.isExtensionHost()) { if(!this.isExtensionHost()) {
this.terminateSession(msg); this.terminateSession(msg);
} }
this.sendEvent(new vscode_debugadapter.TerminatedEvent());
process.exit(0); process.exit(0);
}); });
this._backend.stdout.on('data', (data) => { this._backend.stdout.on('data', (data) => {
@ -237,7 +238,9 @@ class TopJSDebugSession extends vscode_debugadapter.LoggingDebugSession {
} }
disconnectRequest(response, args) { disconnectRequest(response, args) {
if(this.isExtensionHost()) {
this.terminateSession('disconnected'); this.terminateSession('disconnected');
}
this._runtime.quit(); this._runtime.quit();
super.disconnectRequest(response, args); super.disconnectRequest(response, args);
} }
@ -392,38 +395,3 @@ class TopJSDebugSession extends vscode_debugadapter.LoggingDebugSession {
TopJSDebugSession.THREAD_ID = 1; TopJSDebugSession.THREAD_ID = 1;
exports.TopJSDebugSession = TopJSDebugSession; 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());
});
}

View File

@ -212,7 +212,8 @@ class topjsRuntime extends events.EventEmitter {
//this._logger.log('end'); //this._logger.log('end');
}); });
this.client.on('error', (err) => { 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); this._logger.err(err.message);
} }
try { try {