From 1b4197cb3520e4a71f118aac61a83bab1a6f5931 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 22 Apr 2021 18:30:44 +0300 Subject: Use explicit rustc commit-hash Required for lldb on mac --- editors/code/src/debug.ts | 6 ++++-- editors/code/src/toolchain.ts | 10 ++++++++++ editors/code/src/util.ts | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'editors/code/src') diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index 8c6969dc6..830980f96 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode'; import * as path from 'path'; import * as ra from './lsp_ext'; -import { Cargo, getSysroot } from './toolchain'; +import { Cargo, getRustcId, getSysroot } from './toolchain'; import { Ctx } from "./ctx"; import { prepareEnv } from "./run"; @@ -107,9 +107,11 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise { return execute(`${rustcPath} --print sysroot`, { cwd: dir }); } +export async function getRustcId(dir: string): Promise { + const rustcPath = getPathForExecutable("rustc"); + + // do not memoize the result because the toolchain may change between runs + const data = await execute(`${rustcPath} -V -v`, { cwd: dir }); + const rx = /commit-hash:\s(.*)$/m.compile(); + + return rx.exec(data)![1]; +} + /** Mirrors `toolchain::cargo()` implementation */ export function cargoPath(): string { return getPathForExecutable("cargo"); diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index fc5c9e94e..56e0e439e 100644 --- a/editors/code/src/util.ts +++ b/editors/code/src/util.ts @@ -159,4 +159,4 @@ export function execute(command: string, options: ExecOptions): Promise resolve(stdout.trimEnd()); }); }); -} \ No newline at end of file +} -- cgit v1.2.3