Skip to content

Commit b74f479

Browse files
committed
Fix hak check for matrix-seshat (backport #33030)
1 parent dbac03c commit b74f479

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

apps/desktop/hak/matrix-seshat/check.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ import type { Tool } from "../../scripts/hak/hakEnv.ts";
1414
import type { DependencyInfo } from "../../scripts/hak/dep.ts";
1515

1616
export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
17-
const tools: Tool[] = [
18-
["rustc", "--version"],
19-
["python", "--version"], // node-gyp uses python for reasons beyond comprehension
20-
];
17+
const tools: Tool[] = [["rustc", "--version"]];
2118
if (hakEnv.isWin()) {
2219
tools.push(["perl", "--version"]); // for openssl configure
2320
tools.push(["nasm", "-v"]); // for openssl building
@@ -28,6 +25,14 @@ export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Prom
2825
}
2926
await hakEnv.checkTools(tools);
3027

28+
try {
29+
// node-gyp uses python for reasons beyond comprehension
30+
// Try python3 first, to get a more sensible error if python is not found in the fallback
31+
await hakEnv.checkTools([["python3", "--version"]]);
32+
} catch {
33+
await hakEnv.checkTools([["python", "--version"]]);
34+
}
35+
3136
// Ensure Rust target exists (nb. we avoid depending on rustup)
3237
await new Promise((resolve, reject) => {
3338
const rustc = childProcess.execFile(

apps/desktop/scripts/hak/hakEnv.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ export default class HakEnv {
103103
shell: this.isWin(),
104104
...options,
105105
});
106+
proc.on("error", (err) => {
107+
reject(err);
108+
});
106109
proc.on("exit", (code) => {
107110
if (code) {
108111
reject(code);

0 commit comments

Comments
 (0)