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.
Files changed (2) hide show
  1. package/dist/index.js +22 -4
  2. 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 args = ["-y", `${PKG_NAME}@latest`, "start", "--server-ws", cfg.serverUrl, ...cfg.name ? ["--name", cfg.name] : []];
51126
- const log3 = fs16.openSync(LOG_FILE, "a");
51127
- const child = (0, import_node_child_process12.spawn)("npx", args, { detached: true, stdio: ["ignore", log3, log3] });
51128
- child.unref();
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis_test",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "Oasis node daemon + CLI — background daemon, auto-start, full server CLI",
5
5
  "bin": {
6
6
  "oasis": "./dist/index.js"