mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-10-07 14:17:58 +08:00
Add Windows portability guards for workspace flows (#1311)
* Add Windows portability guards for workspace flows * Increase snapshot workflow timeout * Trigger CI after timeout update * Fix windows portability PR after main merge --------- Co-authored-by: neubig <398875+neubig@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
co-authored by
neubig
parent
197588cc8e
commit
df93ca36a7
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env node
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
|
||||
function getNpmInvocation() {
|
||||
if (process.platform !== "win32") {
|
||||
return { command: "npm", args: ["run", "typecheck:staged"] };
|
||||
}
|
||||
|
||||
const npmCliPath =
|
||||
process.env.npm_execpath ??
|
||||
join(dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js");
|
||||
|
||||
if (existsSync(npmCliPath)) {
|
||||
return {
|
||||
command: process.execPath,
|
||||
args: [npmCliPath, "run", "typecheck:staged"],
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
command: process.env.ComSpec ?? "cmd.exe",
|
||||
args: ["/d", "/s", "/c", "npm run typecheck:staged"],
|
||||
};
|
||||
}
|
||||
|
||||
const { command, args } = getNpmInvocation();
|
||||
|
||||
const result = spawnSync(command, args, {
|
||||
stdio: "inherit",
|
||||
windowsHide: true,
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
throw result.error;
|
||||
}
|
||||
|
||||
if (result.signal) {
|
||||
console.error(`typecheck:staged terminated by signal ${result.signal}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.exit(result.status ?? 1);
|
||||
Reference in New Issue
Block a user