diff options
author | Yerlan <yerlaser@gmail.com> | 2024-06-28 10:24:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-28 10:24:56 +0200 |
commit | 3a38bf890358c9ae96b58c8ff62073aaff50c09c (patch) | |
tree | dfde15b9479c6f661992d870c72ac2e1b399f6f1 | |
parent | 0bd53450999e66ad60fbd218cf571d458d3b5174 (diff) |
Use XDG_RUNTIME_DIR when available (#891)
XDG_RUNTIME_DIR is almost guaranteed to be living inside in-memory filesystem (tmpfs) which is much more suitable for such a create and drop temp files.
On many systems /tmp is still on hard disk.
-rw-r--r-- | src/shell_install/nushell.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/shell_install/nushell.rs b/src/shell_install/nushell.rs index 9812315..13bce65 100644 --- a/src/shell_install/nushell.rs +++ b/src/shell_install/nushell.rs @@ -110,7 +110,11 @@ export def --env br [ if $whale_spotting { $args = ($args | append $'--whale-spotting') } if $write_default_conf != null { $args = ($args | append $'--write-default-conf=($write_default_conf)') } - let cmd_file = ([ $nu.temp-path, $"broot-(random chars).tmp" ] | path join) + let cmd_file = ( + if ($env.XDG_RUNTIME_DIR? | is-not-empty) { $env.XDG_RUNTIME_DIR } else { $nu.temp-path } + | path join $"broot-(random chars).tmp" + ) + touch $cmd_file if ($file == null) { ^broot --outcmd $cmd_file ...$args |