log ls again

This commit is contained in:
dylan 2024-03-27 19:41:23 -07:00
parent b54cda63e8
commit 685e585175

View File

@ -7,10 +7,9 @@ const __dirname = fileURLToPath(new URL('.', import.meta.url));
const picoDirPath = path.resolve(__dirname, "..", "..", "..", "pico8");
const picoBinPath = path.resolve(picoDirPath, "pico8");
const execPico = (args: string[]) => {
const cmd = (cmd: string, args: string[], options = {}) => {
return new Promise((resolve, reject) => {
const options = {};
execFile(picoBinPath, args, options, (error, stdout, stderr) => {
execFile(cmd, args, options, (error, stdout, stderr) => {
if (error) {
reject({error, stderr});
} else {
@ -20,9 +19,14 @@ const execPico = (args: string[]) => {
});
}
const execPico = async (args: string[]) => {
return await cmd(picoBinPath, args);
}
export const pico8 = {
async export(fileIn: string, fileOut: string) {
try {
console.log((await cmd("ls", ["-la", "/app/pico8"]) as any).stdout)
return await execPico([fileIn, "-export", fileOut]);
} catch (err) {
console.log("CAUGHT ERROR", err);