A simple, powerful CLI tool to spin up OpenIndiana virtual machines with QEMU
at main 23 lines 593 B view raw
1import { LOGS_DIR } from "../constants.ts"; 2 3export default async function (name: string, follow: boolean) { 4 await Deno.mkdir(LOGS_DIR, { recursive: true }); 5 const logPath = `${LOGS_DIR}/${name}.log`; 6 7 const cmd = new Deno.Command(follow ? "tail" : "cat", { 8 args: [ 9 ...(follow ? ["-n", "100", "-f"] : []), 10 logPath, 11 ], 12 stdin: "inherit", 13 stdout: "inherit", 14 stderr: "inherit", 15 }); 16 17 const status = await cmd.spawn().status; 18 19 if (!status.success) { 20 console.error(`Failed to view logs for virtual machine ${name}.`); 21 Deno.exit(status.code); 22 } 23}