diff --git a/server/src/autoupdater.ts b/server/src/autoupdater.ts index deb978f..a6c72cb 100644 --- a/server/src/autoupdater.ts +++ b/server/src/autoupdater.ts @@ -27,7 +27,7 @@ https.get( function start() { console.log(chalk.blue(`Starting adrift...`)); - let child = spawn(`${dir}/${appname}`, [], { stdio: ["inherit", "inherit", "pipe"] }); + let child = spawn(`${dir}/${appname}`, ["--start"], { stdio: ["inherit", "inherit", "pipe"] }); let errbuf = ""; diff --git a/server/src/main.ts b/server/src/main.ts index 3627bc1..b95738f 100644 --- a/server/src/main.ts +++ b/server/src/main.ts @@ -19,6 +19,7 @@ import fs from "fs"; import { exit } from "process"; import { datadir } from "./lib"; + async function config() { let dir = datadir(); @@ -97,7 +98,7 @@ async function login(credentials: any) { } } } -(async () => { +async function start() { let dir = datadir(); let conf; @@ -152,4 +153,12 @@ async function login(credentials: any) { } }); } -})(); +} + + +if (process.argv[2] != "--start") { + console.error(chalk.red.bold("DO NOT LAUNCH THIS DIRECTLY, YOU SHOULD HAVE DOWNLOADED THE 'autoupdater' BINARY")) + setTimeout(() => process.exit(1), 5000); +} else { + start(); +} \ No newline at end of file