oasis_test 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +22 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51122,10 +51122,28 @@ function stopDaemon() {
|
|
|
51122
51122
|
function selfUpdate() {
|
|
51123
51123
|
const cfg = readConfig();
|
|
51124
51124
|
if (!cfg?.serverUrl) throw new Error("no config \u2014 run `oasis start` first");
|
|
51125
|
-
const
|
|
51126
|
-
const
|
|
51127
|
-
const
|
|
51128
|
-
|
|
51125
|
+
const startArgs = ["-y", `${PKG_NAME}@latest`, "start", "--server-ws", cfg.serverUrl, ...cfg.name ? ["--name", cfg.name] : []];
|
|
51126
|
+
const quoted = startArgs.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
51127
|
+
const inner = `sleep 2; npx ${quoted} >> '${LOG_FILE}' 2>&1`;
|
|
51128
|
+
const hasSystemd = process.platform === "linux" && (() => {
|
|
51129
|
+
try {
|
|
51130
|
+
(0, import_node_child_process12.execSync)("command -v systemd-run", { stdio: "ignore" });
|
|
51131
|
+
return true;
|
|
51132
|
+
} catch {
|
|
51133
|
+
return false;
|
|
51134
|
+
}
|
|
51135
|
+
})();
|
|
51136
|
+
if (hasSystemd) {
|
|
51137
|
+
const child = (0, import_node_child_process12.spawn)("systemd-run", ["--user", "--scope", "--quiet", "sh", "-c", inner], {
|
|
51138
|
+
detached: true,
|
|
51139
|
+
stdio: "ignore"
|
|
51140
|
+
});
|
|
51141
|
+
child.unref();
|
|
51142
|
+
} else {
|
|
51143
|
+
const log3 = fs16.openSync(LOG_FILE, "a");
|
|
51144
|
+
const child = (0, import_node_child_process12.spawn)("sh", ["-c", inner], { detached: true, stdio: ["ignore", log3, log3] });
|
|
51145
|
+
child.unref();
|
|
51146
|
+
}
|
|
51129
51147
|
}
|
|
51130
51148
|
void (async () => {
|
|
51131
51149
|
const [, , cmd] = process.argv;
|