diff --git a/standalone/scripts/dogfood.sh b/standalone/scripts/dogfood.sh index e264cd2..99b55c7 100755 --- a/standalone/scripts/dogfood.sh +++ b/standalone/scripts/dogfood.sh @@ -50,12 +50,17 @@ if [[ "${1:-}" == "--install" ]]; then echo "After that, 'dogfood:standalone --install' will work from then on." exit 1 fi - # Wipe everything except uninstall.exe (managed by NSIS), then copy - TMP_UNINSTALL="$(mktemp)" - cp "$INSTALL_DIR/uninstall.exe" "$TMP_UNINSTALL" - rm -rf "$INSTALL_DIR" - mkdir -p "$INSTALL_DIR" - mv "$TMP_UNINSTALL" "$INSTALL_DIR/uninstall.exe" + # If a previous run left an orphaned sidecar/MouseTerm holding files in + # the install dir, kill it before we try to overwrite anything. + for exe in mouseterm.exe node.exe; do + taskkill //F //T //IM "$exe" >/dev/null 2>&1 || true + done + # Wipe install-dir contents except uninstall.exe (managed by NSIS). + # We delete *contents* rather than the directory itself so we don't trip + # over Windows' "directory in use" if a process has it as cwd or loaded + # an exe image from it. + find "$INSTALL_DIR" -mindepth 1 -maxdepth 1 -not -name 'uninstall.exe' \ + -exec rm -rf {} + cp "$RELEASE_DIR/mouseterm.exe" "$INSTALL_DIR/" cp "$RELEASE_DIR/node.exe" "$INSTALL_DIR/" cp -r "$RELEASE_DIR/_up_/" "$INSTALL_DIR/_up_/" diff --git a/standalone/sidecar/main.js b/standalone/sidecar/main.js index b247dd6..f2562d4 100644 --- a/standalone/sidecar/main.js +++ b/standalone/sidecar/main.js @@ -62,3 +62,18 @@ rl.on('line', (line) => { rl.on('close', () => { mgr.killAll(); process.exit(0); }); process.on('SIGTERM', () => { mgr.killAll(); process.exit(0); }); + +// Watchdog: if the Tauri host crashes or is force-killed, stdin EOF isn't +// always delivered (esp. on Windows), leaving us as an orphan that locks +// the install directory. Poll the parent PID and self-exit when it's gone. +const parentPid = process.ppid; +if (parentPid && parentPid > 0) { + setInterval(() => { + try { + process.kill(parentPid, 0); + } catch { + mgr.killAll(); + process.exit(0); + } + }, 2000).unref(); +} diff --git a/standalone/src/AppBar.tsx b/standalone/src/AppBar.tsx index f06e3ee..03689fa 100644 --- a/standalone/src/AppBar.tsx +++ b/standalone/src/AppBar.tsx @@ -149,10 +149,10 @@ function ShellDropdown({ shells }: { shells: ShellEntry[] }) { className="absolute left-0 top-full z-50 mt-1 w-max flex-col py-1" > {shells.map((shell) => { - const isSelected = shell.path === selected?.path; + const isSelected = shell.name === selected?.name; return (