mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-17 20:44:27 +01:00
Co-authored-by: Johannes Rieken <jrieken@microsoft.com> Co-authored-by: Alexandru Dima <alexdima@microsoft.com>
26 lines
983 B
TypeScript
26 lines
983 B
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { writeFileSync } from 'fs';
|
|
import { tmpdir } from 'os';
|
|
import { randomPath } from '../../../base/common/extpath.js';
|
|
|
|
export function createWaitMarkerFileSync(verbose?: boolean): string | undefined {
|
|
const randomWaitMarkerPath = randomPath(tmpdir());
|
|
|
|
try {
|
|
writeFileSync(randomWaitMarkerPath, ''); // use built-in fs to avoid dragging in more dependencies
|
|
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;
|
|
}
|
|
}
|