diff options
| author | vsrs <vit@conrlab.com> | 2021-04-22 16:09:46 +0300 |
|---|---|---|
| committer | vsrs <vit@conrlab.com> | 2021-04-22 16:09:46 +0300 |
| commit | 1ebfe11730191e914dcf20297cdfdac5b7c297fc (patch) | |
| tree | ae6caf9e8fd50e3eac826d0a3f0698c6e047544f /editors/code/src/toolchain.ts | |
| parent | 8f781e782c7e16aa323672620753ec31526d2b90 (diff) | |
| download | rust-1ebfe11730191e914dcf20297cdfdac5b7c297fc.tar.gz rust-1ebfe11730191e914dcf20297cdfdac5b7c297fc.zip | |
Add special `auto` value for `debug.sourceFileMap`
Diffstat (limited to 'editors/code/src/toolchain.ts')
| -rw-r--r-- | editors/code/src/toolchain.ts | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/editors/code/src/toolchain.ts b/editors/code/src/toolchain.ts index b746da1d92c..5725bcafe2f 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<string> { - 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<string> { + 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 */ |
