Skip to content

Commit

Permalink
Use EUID to detect superuser
Browse files Browse the repository at this point in the history
  • Loading branch information
IlanCosman committed Jul 29, 2022
1 parent 132dff7 commit 6906f7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion functions/_tide_item_context.fish
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function _tide_item_context
if set -q SSH_TTY
tide_context_color=$tide_context_color_ssh _tide_print_item context $USER@$hostname
else if contains -- $USER root toor Administrator
else if test "$EUID" = 0
tide_context_color=$tide_context_color_root _tide_print_item context $USER@$hostname
else if test "$tide_context_always_display" = true
tide_context_color=$tide_context_color_default _tide_print_item context $USER@$hostname
Expand Down
4 changes: 2 additions & 2 deletions tests/_tide_item_context.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ _context # CHECK: {{.*@.*}}
set -g SSH_TTY /dev/pts/0
_context # CHECK: {{.*@.*}}

set USER root
_context # CHECK: {{root@.*}}
set EUID 0
_context # CHECK: {{.*@.*}}

0 comments on commit 6906f7e

Please sign in to comment.