diff --git a/main.ts b/main.ts index 725d1ab..d9fe32b 100644 --- a/main.ts +++ b/main.ts @@ -27,14 +27,20 @@ try { if (!(error instanceof Deno.errors.NotFound)) { throw error; } + console.log("'bunker.db' not found, creating..."); const cmd = new Deno.Command("sqlite3", { args: ["bunker.db", ".read database.sql"], stdout: "piped", stderr: "piped", }); - console.log( - await cmd.output().then((out) => new TextDecoder().decode(out.stdout)), - ); + const cmdChild = cmd.spawn(); + cmdChild.stdout.pipeTo(Deno.stdout.writable); + cmdChild.stderr.pipeTo(Deno.stderr.writable); + const status = await cmdChild.status; + if (!status.success) { + console.log("failed creating 'bunker.db', exiting..."); + Deno.exit(1); + } } class SqliteDb implements Db {