Skip to content

Commit

Permalink
Don't consume leftover stdin in cleanup tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
andsens committed Aug 28, 2024
1 parent 7f8a7e3 commit 1ee3ccf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ssh-sudo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ cat \"$fifopath\"" >/dev/null || return $?
ssh_cmd tee -a "$fifopath" >/dev/null <<<"${SSH_SUDO_PASS:?}" & fifopid=$!
} <<<''
ssh_cmd SUDO_ASKPASS="$askpath" sudo -Aku "${SSH_SUDO_USER:-root}" "$scriptpath" || ret=$?
ssh_cmd rm -f "$askpath" "$fifopath" || true
ssh_sudo_cmd rm -f "$scriptpath" || true
{
ssh_cmd rm -f "$askpath" "$fifopath" || true
ssh_sudo_cmd rm -f "$scriptpath" || true
} <<<''
kill -TERM $fifopid >/dev/null 2>&1 || true
return $ret
}

0 comments on commit 1ee3ccf

Please sign in to comment.