Skip to content

Commit

Permalink
shell config: only resize if on tty
Browse files Browse the repository at this point in the history
Resize is only called if stdout is opened. If it is not opened, there is
no TTY to be resized.

The previous configuration calls resize on any login shell through
/etc/profile, which outputs an error messages on shells not on a tty.
(That can occur when using ssh to call a command directly, i.e.
`ssh host echo foo`).
  • Loading branch information
tropf committed Oct 7, 2024
1 parent 93e314c commit 6543d38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions share/modules/nixos-shell-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ in {
path = builtins.getEnv "PATH";
in
''
# fix terminal size
eval "$(resize)"
# if terminal with stdout, fix terminal size
if [ -t 1 ]; then eval "$(resize)"; fi
${lib.optionalString (pwd != "") "cd '${pwd}' 2>/dev/null"}
${lib.optionalString (term != "") "export TERM='${term}'"}
Expand Down

0 comments on commit 6543d38

Please sign in to comment.