mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-17 05:41:07 +01:00
fix #69588
This commit is contained in:
+12
-13
@@ -5,7 +5,8 @@
|
||||
|
||||
import { spawn, ChildProcess } from 'child_process';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { buildHelpMessage, buildVersionMessage } from 'vs/platform/environment/node/argv';
|
||||
import { buildHelpMessage, buildVersionMessage, addArg } from 'vs/platform/environment/node/argv';
|
||||
import { parseCLIProcessArgv, createWaitMarkerFile } from 'vs/platform/environment/node/argvHelper';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import pkg from 'vs/platform/product/node/package';
|
||||
@@ -19,8 +20,6 @@ import * as iconv from 'iconv-lite';
|
||||
import { writeFileAndFlushSync } from 'vs/base/node/extfs';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { ProfilingSession, Target } from 'v8-inspect-profiler';
|
||||
import { createWaitMarkerFile } from 'vs/code/node/wait';
|
||||
import { parseCLIProcessArgv } from 'vs/platform/environment/node/argvHelper';
|
||||
|
||||
function shouldSpawnCliProcess(argv: ParsedArgs): boolean {
|
||||
return !!argv['install-source']
|
||||
@@ -180,11 +179,11 @@ export async function main(argv: string[]): Promise<any> {
|
||||
});
|
||||
|
||||
// Make sure to open tmp file
|
||||
argv.push(stdinFilePath);
|
||||
addArg(argv, stdinFilePath);
|
||||
|
||||
// Enable --wait to get all data and ignore adding this to history
|
||||
argv.push('--wait');
|
||||
argv.push('--skip-add-to-recently-opened');
|
||||
addArg(argv, '--wait');
|
||||
addArg(argv, '--skip-add-to-recently-opened');
|
||||
args.wait = true;
|
||||
}
|
||||
|
||||
@@ -232,7 +231,7 @@ export async function main(argv: string[]): Promise<any> {
|
||||
if (args.wait) {
|
||||
waitMarkerFilePath = await createWaitMarkerFile(verbose);
|
||||
if (waitMarkerFilePath) {
|
||||
argv.push('--waitMarkerFilePath', waitMarkerFilePath);
|
||||
addArg(argv, '--waitMarkerFilePath', waitMarkerFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,11 +251,11 @@ export async function main(argv: string[]): Promise<any> {
|
||||
|
||||
const filenamePrefix = paths.join(os.homedir(), 'prof-' + Math.random().toString(16).slice(-4));
|
||||
|
||||
argv.push(`--inspect-brk=${portMain}`);
|
||||
argv.push(`--remote-debugging-port=${portRenderer}`);
|
||||
argv.push(`--inspect-brk-extensions=${portExthost}`);
|
||||
argv.push(`--prof-startup-prefix`, filenamePrefix);
|
||||
argv.push(`--no-cached-data`);
|
||||
addArg(argv, `--inspect-brk=${portMain}`);
|
||||
addArg(argv, `--remote-debugging-port=${portRenderer}`);
|
||||
addArg(argv, `--inspect-brk-extensions=${portExthost}`);
|
||||
addArg(argv, `--prof-startup-prefix`, filenamePrefix);
|
||||
addArg(argv, `--no-cached-data`);
|
||||
|
||||
fs.writeFileSync(filenamePrefix, argv.slice(-6).join('|'));
|
||||
|
||||
@@ -341,7 +340,7 @@ export async function main(argv: string[]): Promise<any> {
|
||||
if (args['js-flags']) {
|
||||
const match = /max_old_space_size=(\d+)/g.exec(args['js-flags']);
|
||||
if (match && !args['max-memory']) {
|
||||
argv.push(`--max-memory=${match[1]}`);
|
||||
addArg(argv, `--max-memory=${match[1]}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { tmpdir } from 'os';
|
||||
import { writeFile } from 'vs/base/node/pfs';
|
||||
|
||||
export function createWaitMarkerFile(verbose?: boolean): Promise<string> {
|
||||
const randomWaitMarkerPath = join(tmpdir(), Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10));
|
||||
|
||||
return writeFile(randomWaitMarkerPath, '').then(() => {
|
||||
if (verbose) {
|
||||
console.log(`Marker file for --wait created: ${randomWaitMarkerPath}`);
|
||||
}
|
||||
|
||||
return randomWaitMarkerPath;
|
||||
}, error => {
|
||||
if (verbose) {
|
||||
console.error(`Failed to create marker file for --wait: ${error}`);
|
||||
}
|
||||
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user