runVSCodeCommand only resolves on success (it throws on a non-zero exit), so its stderr is non-fatal output such as the Node [DEP0169] url.parse() deprecation warning emitted by the VS Code CLI. Log it as a warning instead of an error in installAndCopyBinaries.ts, and add DEP0169 to the test.ts stdio filter list.
38 lines
1.6 KiB
TypeScript
38 lines
1.6 KiB
TypeScript
/* --------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All Rights Reserved.
|
|
* See 'LICENSE' in the project root for license information.
|
|
* ------------------------------------------------------------------------------------------ */
|
|
|
|
import { runVSCodeCommand } from '@vscode/test-electron';
|
|
import { writeFile } from 'node:fs/promises';
|
|
import { join } from 'node:path';
|
|
import { $root, error, heading, note, warn } from './common';
|
|
import * as copy from './copyExtensionBinaries';
|
|
import { install, isolated, options } from "./vscode";
|
|
|
|
export async function main() {
|
|
console.log(heading(`Install VS Code`));
|
|
const vscode = await install();
|
|
if (!vscode) {
|
|
error('Failed to install VS Code');
|
|
return;
|
|
}
|
|
|
|
console.log(heading('Install latest C/C++ Extension'));
|
|
const result = await runVSCodeCommand([...vscode.args ?? [], '--install-extension', 'ms-vscode.cpptools', '--pre-release'], options);
|
|
if (result.stdout) {
|
|
console.log(result.stdout.toString());
|
|
}
|
|
if (result.stderr) {
|
|
// runVSCodeCommand resolves only when the command succeeds (it throws on a non-zero exit), so stderr here is
|
|
// non-fatal output such as Node deprecation warnings and must not be reported as an error.
|
|
warn(result.stderr.toString());
|
|
}
|
|
|
|
const binaryVersion = await copy.main(isolated);
|
|
if (binaryVersion) {
|
|
await writeFile(join($root, 'bin', 'binaryVersion.json'), JSON.stringify({ version: binaryVersion }));
|
|
note(`Wrote binary version ${binaryVersion} to bin/binaryVersion.json`);
|
|
}
|
|
}
|