mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:36 +01:00
fix(tuios): handle stopped daemon during shell startup
This commit is contained in:
1 parent
4a27852fd1
commit
19b9aff7bf
1 file changed
+6
-1
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user