mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Add command to kill server and trigger handled error
This commit is contained in:
parent
23be24d828
commit
31a15b5b9a
|
@ -47,6 +47,11 @@
|
|||
"title": "Show Log",
|
||||
"category": "Remote-TestResolver",
|
||||
"command": "vscode-testresolver.showLog"
|
||||
},
|
||||
{
|
||||
"title": "Kill Server and Trigger Handled Error",
|
||||
"category": "Remote-TestResolver",
|
||||
"command": "vscode-testresolver.killServerAndTriggerHandledError"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
|
|
|
@ -206,7 +206,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
});
|
||||
}
|
||||
|
||||
vscode.workspace.registerRemoteAuthorityResolver('test', {
|
||||
const authorityResolverDisposable = vscode.workspace.registerRemoteAuthorityResolver('test', {
|
||||
resolve(_authority: string): Thenable<vscode.ResolvedAuthority> {
|
||||
return vscode.window.withProgress({
|
||||
location: vscode.ProgressLocation.Notification,
|
||||
|
@ -222,6 +222,17 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
vscode.commands.registerCommand('vscode-testresolver.newWindowWithError', () => {
|
||||
return vscode.commands.executeCommand('vscode.newWindow', { remoteAuthority: 'test+error' });
|
||||
});
|
||||
vscode.commands.registerCommand('vscode-testresolver.killServerAndTriggerHandledError', () => {
|
||||
authorityResolverDisposable.dispose();
|
||||
if (extHostProcess) {
|
||||
terminateProcess(extHostProcess, context.extensionPath);
|
||||
}
|
||||
vscode.workspace.registerRemoteAuthorityResolver('test', {
|
||||
async resolve(_authority: string): Promise<vscode.ResolvedAuthority> {
|
||||
throw vscode.RemoteAuthorityResolverError.NotAvailable('Intentional Error', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
vscode.commands.registerCommand('vscode-testresolver.showLog', () => {
|
||||
if (outputChannel) {
|
||||
outputChannel.show();
|
||||
|
|
|
@ -23,7 +23,7 @@ export function terminateProcess(p: cp.ChildProcess, extensionPath: string): Ter
|
|||
} else if (process.platform === 'darwin' || process.platform === 'linux') {
|
||||
try {
|
||||
const cmd = path.join(extensionPath, 'scripts', 'terminateProcess.sh');
|
||||
const result = cp.spawnSync(cmd, [process.pid.toString()]);
|
||||
const result = cp.spawnSync(cmd, [p.pid.toString()]);
|
||||
if (result.error) {
|
||||
return { success: false, error: result.error };
|
||||
}
|
||||
|
@ -34,4 +34,4 @@ export function terminateProcess(p: cp.ChildProcess, extensionPath: string): Ter
|
|||
p.kill('SIGKILL');
|
||||
}
|
||||
return { success: true };
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue