yq doesn't read stdin when called with sudo
ChristianS99 opened this issue ยท 7 comments
Describe the bug
yq doesn't seem to read stdin when called with sudo
Version of yq: 4.44.2
Operating system: ubuntu
Installed via: snap
Command
-
echo "some: yaml" | yq .
-
echo "some: yaml" | sudo yq .
Actual behavior
- outputs
some: yaml
- doesn't output anything and doesn't return indefinitely (at least some minutes, didn't wait longer)
Expected behavior
- as it should be
- outputs
some: yaml
(as 1))
Additional context
Okay, but what the point or use case of using stdin + sudo ?
I'm curious
i don't use it like that, yq is used inside a script that is running with sudo, there is the same problem. I just reduced it to this.
So you mean the following script works without sudo, but doesn't with?
file.sh
#!/bin/sh
echo "some: yaml" | yq .
$ ./file.sh
$ sudo ./file.sh
actually i have yq . < <filename>
, but in the reduced form , there wasn't a difference.
Thanks is clearer now.
Let's wait for maintainer feedback
Sorry for noise, it seems not to be a problem of reading stdin or yq at all:
sudo yq . <filename>
, hangs, too, there yq should open the file directly and read it- on a system where yq (in same version) is installed directly, not with snap,
sudo yq . <filename>
andecho "some: yaml" | sudo yq .
just work.
so its a WTF snap, I guess....
That's why I started using homebrew on Linux. Easy, not as complicated as nix