diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte
index d6dbfb2..7d543a2 100644
--- a/frontend/src/App.svelte
+++ b/frontend/src/App.svelte
@@ -193,7 +193,11 @@
-
+
+
diff --git a/server/src/autoupdater.ts b/server/src/autoupdater.ts
index 172bce9..deb978f 100644
--- a/server/src/autoupdater.ts
+++ b/server/src/autoupdater.ts
@@ -2,6 +2,7 @@ import { datadir } from "./lib";
import { spawn } from "child_process";
import fs from "fs";
import { https } from 'follow-redirects';
+import chalk from "chalk";
let dir = datadir();
let platform = `${process.platform}-${process.arch}`
let appname = `adrift-server-${platform}`;
@@ -18,7 +19,27 @@ https.get(
fs.chmodSync(`${dir}/${appname}`, "755");
setTimeout(() => {
// this timeout shouldn't be needed, but it is
- spawn(`${dir}/${appname}`, [], { stdio: "inherit" });
+ start();
}, 2000);
});
- })
\ No newline at end of file
+ })
+
+function start() {
+ console.log(chalk.blue(`Starting adrift...`));
+
+ let child = spawn(`${dir}/${appname}`, [], { stdio: ["inherit", "inherit", "pipe"] });
+
+ let errbuf = "";
+
+ child.stderr!.on("data", e => {
+ let err = e.toString();
+ console.error(err);
+ errbuf += err;
+ });
+ child.on("exit", (e) => {
+ // upload `err` as telemetry?
+ console.log(chalk.red(`Adrift crashed! exit code ${e}`));
+ console.log(chalk.green("restarting in 3 seconds"));
+ setTimeout(start, 3000);
+ });
+}
\ No newline at end of file