Merge from vscode 966b87dd4013be1a9c06e2b8334522ec61905cc2 (#4696)

This commit is contained in:
Anthony Dresser
2019-03-26 11:43:38 -07:00
committed by GitHub
parent b1393ae615
commit 0d8ef9583b
268 changed files with 5947 additions and 3422 deletions

View File

@@ -7,6 +7,8 @@ import * as minimist from 'minimist';
import * as os from 'os';
import { localize } from 'vs/nls';
import { ParsedArgs } from 'vs/platform/environment/common/environment';
import { join } from 'path';
import { writeFileSync } from 'fs';
/**
* This code is also used by standalone cli's. Avoid adding any other dependencies.
@@ -263,3 +265,20 @@ export function addArg(argv: string[], ...args: string[]): string[] {
return argv;
}
export function createWaitMarkerFile(verbose?: boolean): string | undefined {
const randomWaitMarkerPath = join(os.tmpdir(), Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10));
try {
writeFileSync(randomWaitMarkerPath, '');
if (verbose) {
console.log(`Marker file for --wait created: ${randomWaitMarkerPath}`);
}
return randomWaitMarkerPath;
} catch (err) {
if (verbose) {
console.error(`Failed to create marker file for --wait: ${err}`);
}
return undefined;
}
}

View File

@@ -4,14 +4,11 @@
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { tmpdir } from 'os';
import { firstIndex } from 'vs/base/common/arrays';
import { localize } from 'vs/nls';
import { ParsedArgs } from '../common/environment';
import { MIN_MAX_MEMORY_SIZE_MB } from 'vs/platform/files/common/files';
import { parseArgs } from 'vs/platform/environment/node/argv';
import { join } from 'vs/base/common/path';
import { writeFile } from 'vs/base/node/pfs';
function validate(args: ParsedArgs): ParsedArgs {
if (args.goto) {
@@ -60,21 +57,3 @@ export function parseCLIProcessArgv(processArgv: string[]): ParsedArgs {
return validate(parseArgs(args));
}
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);
});
}