test(hopper): verify alternate Linux launcher path
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { access } from "node:fs/promises";
|
||||
import { access, mkdtemp, rm, symlink } from "node:fs/promises";
|
||||
import { execFile } from "node:child_process";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
@@ -14,5 +16,14 @@ await access("/usr/bin/python3");
|
||||
const linked = await execFileAsync("ldd", [launcher]);
|
||||
if (`${linked.stdout}\n${linked.stderr}`.includes("not found"))
|
||||
throw new Error("Hopper has unresolved shared-library dependencies");
|
||||
process.env.HOPPER_LAUNCHER_PATH = launcher;
|
||||
await import("./verify-real-hopper.mjs");
|
||||
const alternateDirectory = await mkdtemp(
|
||||
join(tmpdir(), "rea-real-hopper-launcher-"),
|
||||
);
|
||||
const alternateLauncher = join(alternateDirectory, "Hopper-alternate");
|
||||
try {
|
||||
await symlink(launcher, alternateLauncher);
|
||||
process.env.HOPPER_LAUNCHER_PATH = alternateLauncher;
|
||||
await import("./verify-real-hopper.mjs");
|
||||
} finally {
|
||||
await rm(alternateDirectory, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user