aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/toolchain.ts
diff options
context:
space:
mode:
authorvsrs <[email protected]>2021-04-22 14:09:46 +0100
committervsrs <[email protected]>2021-04-22 14:09:46 +0100
commit1ebfe11730191e914dcf20297cdfdac5b7c297fc (patch)
treeae6caf9e8fd50e3eac826d0a3f0698c6e047544f /editors/code/src/toolchain.ts
parent8f781e782c7e16aa323672620753ec31526d2b90 (diff)
Add special `auto` value for `debug.sourceFileMap`
Diffstat (limited to 'editors/code/src/toolchain.ts')
-rw-r--r--editors/code/src/toolchain.ts23
1 files changed, 5 insertions, 18 deletions
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';
4import * as fs from 'fs'; 4import * as fs from 'fs';
5import * as readline from 'readline'; 5import * as readline from 'readline';
6import { OutputChannel } from 'vscode'; 6import { OutputChannel } from 'vscode';
7import { log, memoize } from './util'; 7import { execute, log, memoize } from './util';
8 8
9interface CompilationArtifact { 9interface CompilationArtifact {
10 fileName: string; 10 fileName: string;
@@ -122,24 +122,11 @@ export class Cargo {
122} 122}
123 123
124/** Mirrors `project_model::sysroot::discover_sysroot_dir()` implementation*/ 124/** Mirrors `project_model::sysroot::discover_sysroot_dir()` implementation*/
125export function sysrootForDir(dir: string): Promise<string> { 125export function getSysroot(dir: string): Promise<string> {
126 const rustc_path = getPathForExecutable("rustc"); 126 const rustcPath = getPathForExecutable("rustc");
127
128 return new Promise((resolve, reject) => {
129 cp.exec(`${rustc_path} --print sysroot`, { cwd: dir }, (err, stdout, stderr) => {
130 if (err) {
131 reject(err);
132 return;
133 }
134
135 if (stderr) {
136 reject(new Error(stderr));
137 return;
138 }
139 127
140 resolve(stdout.trimEnd()); 128 // do not memoize the result because the toolchain may change between runs
141 }); 129 return execute(`${rustcPath} --print sysroot`, { cwd: dir });
142 });
143} 130}
144 131
145/** Mirrors `toolchain::cargo()` implementation */ 132/** Mirrors `toolchain::cargo()` implementation */