From 1ebfe11730191e914dcf20297cdfdac5b7c297fc Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 22 Apr 2021 16:09:46 +0300 Subject: Add special `auto` value for `debug.sourceFileMap` --- editors/code/src/toolchain.ts | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'editors/code/src/toolchain.ts') diff --git a/editors/code/src/toolchain.ts b/editors/code/src/toolchain.ts index b746da1d9..5725bcafe 100644 --- a/editors/code/src/toolchain.ts +++ b/editors/code/src/toolchain.ts @@ -4,7 +4,7 @@ import * as path from 'path'; import * as fs from 'fs'; import * as readline from 'readline'; import { OutputChannel } from 'vscode'; -import { log, memoize } from './util'; +import { execute, log, memoize } from './util'; interface CompilationArtifact { fileName: string; @@ -122,24 +122,11 @@ export class Cargo { } /** Mirrors `project_model::sysroot::discover_sysroot_dir()` implementation*/ -export function sysrootForDir(dir: string): Promise { - const rustc_path = getPathForExecutable("rustc"); - - return new Promise((resolve, reject) => { - cp.exec(`${rustc_path} --print sysroot`, { cwd: dir }, (err, stdout, stderr) => { - if (err) { - reject(err); - return; - } - - if (stderr) { - reject(new Error(stderr)); - return; - } +export function getSysroot(dir: string): Promise { + const rustcPath = getPathForExecutable("rustc"); - resolve(stdout.trimEnd()); - }); - }); + // do not memoize the result because the toolchain may change between runs + return execute(`${rustcPath} --print sysroot`, { cwd: dir }); } /** Mirrors `toolchain::cargo()` implementation */ -- cgit v1.2.3