mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 19:59:37 +00:00
@@ -974,7 +974,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
||||
}
|
||||
|
||||
if (this.apiVersion.gte(API.v222)) {
|
||||
this.cancellationPipeName = electron.getTempSock('tscancellation');
|
||||
this.cancellationPipeName = electron.getTempFile('tscancellation');
|
||||
args.push('--cancellationPipeName', this.cancellationPipeName + '*');
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import Logger from './logger';
|
||||
import { getTempFile, makeRandomHexString } from './temp';
|
||||
import * as temp from './temp';
|
||||
import path = require('path');
|
||||
import os = require('os');
|
||||
import fs = require('fs');
|
||||
import net = require('net');
|
||||
import cp = require('child_process');
|
||||
|
||||
@@ -15,13 +15,25 @@ export interface IForkOptions {
|
||||
execArgv?: string[];
|
||||
}
|
||||
|
||||
export function getTempSock(prefix: string): string {
|
||||
const fullName = `vscode-${prefix}-${makeRandomHexString(20)}`;
|
||||
return getTempFile(fullName + '.sock');
|
||||
const getRootTempDir = (() => {
|
||||
let dir: string | undefined;
|
||||
return () => {
|
||||
if (!dir) {
|
||||
dir = temp.getTempFile(`vscode-typescript`);
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir);
|
||||
}
|
||||
}
|
||||
return dir;
|
||||
};
|
||||
})();
|
||||
|
||||
export function getTempFile(prefix: string): string {
|
||||
return path.join(getRootTempDir(), `${prefix}-${temp.makeRandomHexString(20)}.tmp`);
|
||||
}
|
||||
|
||||
function generatePipeName(): string {
|
||||
return getPipeName(makeRandomHexString(40));
|
||||
return getPipeName(temp.makeRandomHexString(40));
|
||||
}
|
||||
|
||||
function getPipeName(name: string): string {
|
||||
@@ -31,7 +43,7 @@ function getPipeName(name: string): string {
|
||||
}
|
||||
|
||||
// Mac/Unix: use socket file
|
||||
return path.join(os.tmpdir(), fullName + '.sock');
|
||||
return path.join(getRootTempDir(), fullName + '.sock');
|
||||
}
|
||||
|
||||
function generatePatchedEnv(
|
||||
|
||||
Reference in New Issue
Block a user