mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Fixing cancellation errors for TS. Fixes #28501
This commit is contained in:
parent
78250b41d2
commit
01fa0b83e9
|
@ -497,7 +497,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
|||
args.push('--enableTelemetry');
|
||||
}
|
||||
if (this.apiVersion.has222Features()) {
|
||||
this.cancellationPipeName = electron.getPipeName(`tscancellation-${electron.makeRandomHexString(20)}`);
|
||||
this.cancellationPipeName = electron.getTempFile(`tscancellation-${electron.makeRandomHexString(20)}`);
|
||||
args.push('--cancellationPipeName', this.cancellationPipeName + '*');
|
||||
}
|
||||
|
||||
|
@ -947,7 +947,11 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
|||
|
||||
if (this.apiVersion.has222Features() && this.cancellationPipeName) {
|
||||
this.tracer.logTrace(`TypeScript Service: trying to cancel ongoing request with sequence number ${seq}`);
|
||||
fs.writeFileSync(this.cancellationPipeName + seq, '');
|
||||
try {
|
||||
fs.writeFileSync(this.cancellationPipeName + seq, '');
|
||||
} catch (e) {
|
||||
// noop
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@ export function makeRandomHexString(length: number): string {
|
|||
function generatePipeName(): string {
|
||||
return getPipeName(makeRandomHexString(40));
|
||||
}
|
||||
|
||||
export function getPipeName(name: string): string {
|
||||
function getPipeName(name: string): string {
|
||||
const fullName = 'vscode-' + name;
|
||||
if (process.platform === 'win32') {
|
||||
return '\\\\.\\pipe\\' + fullName + '-sock';
|
||||
|
@ -38,6 +37,11 @@ export function getPipeName(name: string): string {
|
|||
return path.join(os.tmpdir(), fullName + '.sock');
|
||||
}
|
||||
|
||||
export function getTempFile(name: string): string {
|
||||
const fullName = 'vscode-' + name;
|
||||
return path.join(os.tmpdir(), fullName + '.sock');
|
||||
}
|
||||
|
||||
|
||||
function generatePatchedEnv(env: any, stdInPipeName: string, stdOutPipeName: string, stdErrPipeName: string): any {
|
||||
// Set the two unique pipe names and the electron flag as process env
|
||||
|
|
Loading…
Reference in a new issue