Add special auto value for debug.sourceFileMap

This commit is contained in:
vsrs 2021-04-22 16:09:46 +03:00
parent 8f781e782c
commit 1ebfe11730
5 changed files with 38 additions and 27 deletions

View file

@ -1,7 +1,7 @@
import * as lc from "vscode-languageclient/node";
import * as vscode from "vscode";
import { strict as nativeAssert } from "assert";
import { spawnSync } from "child_process";
import { exec, ExecOptions, spawnSync } from "child_process";
import { inspect } from "util";
export function assert(condition: boolean, explanation: string): asserts condition {
@ -141,3 +141,22 @@ export function memoize<Ret, TThis, Param extends string>(func: (this: TThis, ar
return result;
};
}
/** Awaitable wrapper around `child_process.exec` */
export function execute(command: string, options: ExecOptions): Promise<string> {
return new Promise((resolve, reject) => {
exec(command, options, (err, stdout, stderr) => {
if (err) {
reject(err);
return;
}
if (stderr) {
reject(new Error(stderr));
return;
}
resolve(stdout.trimEnd());
});
});
}