Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"echo vi | sudo pacman -R -" works in bash but exits without reading input in Elvish #1775

Open
1 task done
xiaq opened this issue Mar 24, 2024 · 0 comments
Open
1 task done

Comments

@xiaq
Copy link
Member

xiaq commented Mar 24, 2024

What happened, and what did you expect to happen?

Pacman is Archlinux's package manager and pacman -R - removes packages given via stdin after user confirmation.

The following works in bash:

[root@d415da14d875 ~]# echo vi | sudo pacman -R -
checking dependencies...

Package (1)  Old Version  Net Change

vi           1:070224-6    -0.31 MiB

Total Removed Size:  0.31 MiB

:: Do you want to remove these packages? [Y/n]

That is, it waits for user input before proceeding to remove the packages specified, but on Elvish the second command exits immediately:

~# echo vi | sudo pacman -R -
checking dependencies...

Package (1)  Old Version  Net Change

vi           1:070224-6    -0.31 MiB

Total Removed Size:  0.31 MiB

:: Do you want to remove these packages? [Y/n] Exception: sudo exited with 1
  [tty 1]:1:11-26: echo vi | sudo pacman -R -

Interestingly, removing the use of sudo (echo vi | pacman -R -) makes the pipeline work on Elvish.

Since pacman has its stdin redirected, it must be reading its input directly from the terminal rather than FD 0.

I have a vague suspicion that this has to do with job control, and sudo is making some assumptions that somehow don't hold in Elvish.

Output of "elvish -version"

0.20.1+archlinux4

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant