chore: split up default terminal commands

This commit is contained in:
James Murdza 2024-09-05 15:12:29 -07:00
parent 0e4649b2c9
commit b8398cc4c2

View File

@ -526,9 +526,15 @@ io.on("connection", async (socket) => {
rows: 20, rows: 20,
//onExit: () => console.log("Terminal exited", id), //onExit: () => console.log("Terminal exited", id),
}); });
await terminals[id].sendData(
`cd "${path.join(dirName, "projects", data.sandboxId)}"\rexport PS1='user> '\rclear\r` const defaultDirectory = path.join(dirName, "projects", data.sandboxId);
); const defaultCommands = [
`cd "${defaultDirectory}"`,
"export PS1='user> '",
"clear"
]
for (const command of defaultCommands) await terminals[id].sendData(command + "\r");
console.log("Created terminal", id); console.log("Created terminal", id);
} catch (e: any) { } catch (e: any) {
console.error(`Error creating terminal ${id}:`, e); console.error(`Error creating terminal ${id}:`, e);