From 19b9aff7bf296ba55f1eaaa29f92f243a062832e Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Thu, 8 Oct 2026 23:39:38 +0800 Subject: [PATCH] fix(tuios): handle stopped daemon during shell startup --- home/base/tui/tuios/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/home/base/tui/tuios/default.nix b/home/base/tui/tuios/default.nix index 34f29f5f..2f874b8d 100644 --- a/home/base/tui/tuios/default.nix +++ b/home/base/tui/tuios/default.nix @@ -24,7 +24,12 @@ in programs.nushell.extraConfig = '' # auto start tuios if $nu.is-interactive and (not ("TUIOS_SESSION" in $env)) { - let sessions = (^tuios ls --json | from json | get name) + # Exit 3 means the daemon is stopped; stdout still lists saved sessions. + let listing = (^tuios ls --json | complete) + if $listing.exit_code not-in [0 3] { + error make {msg: $"tuios ls failed: ($listing.stderr)"} + } + let sessions = ($listing.stdout | from json | get name) let work_root = ($nu.home-dir | path join "work") if $env.PWD == $work_root or ($env.PWD | str starts-with $"($work_root)/") { if "work" not-in $sessions {