try explicitly setting PATH

This commit is contained in:
dylan 2024-03-26 20:27:56 -07:00
parent 2e6bafb0f0
commit 4661516484

View File

@ -18,9 +18,9 @@ const url = "/api/release";
const payloadT = Type.Any();
const repoPath = "./repo"; // path.resolve(__dirname, "..", "..", "..", "repo");
const picoDirPath = "./pico8"; // path.resolve(__dirname, "..", "..", "..", "pico8");
const picoBinPath = "./pico8/pico8"; // path.resolve(picoDirPath, "pico8");
const repoPath = path.resolve(__dirname, "..", "..", "..", "repo");
const picoDirPath = path.resolve(__dirname, "..", "..", "..", "pico8");
const picoBinPath = path.resolve(picoDirPath, "pico8");
// const {stdout, } = await execa(picoBinPath, ["/home/dylan/.lexaloffle/pico-8/carts/candles/candles.p8", "-export", path.join(__dirname, "result.js")]);
// const {stdout, } = await execa("ls", ["-la", picoDirPath]);
@ -58,7 +58,7 @@ const handler = async ({payload}: FirRouteInput<typeof payloadT>) => {
console.log("main exists: ", fs.existsSync(path.join(repoPath, manifest.main)));
const {stdout} = await execa("ls", ["-la", picoDirPath], {shell: true});
console.log(stdout);
await execa(picoBinPath, [path.join(repoPath, manifest.main), "-export", path.join(repoPath, "result.js")], {shell: true});
await execa(picoBinPath, [path.join(repoPath, manifest.main), "-export", path.join(repoPath, "result.js")], {env: {PATH: "/app/pico8"}});
// await execa(picoBinPath, [path.join(repoPath, manifest.main), "-export", path.join(repoPath, "result.png")]);
const js = await fs.promises.readFile(path.join(repoPath, "result.js"), "utf8");
// const png = Buffer.from(await fs.promises.readFile(path.join(repoPath, "result.png"))).toString("base64");