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

Unable to install fisher without a proper TTY #791

Closed
inkhey opened this issue Aug 24, 2024 · 3 comments
Closed

Unable to install fisher without a proper TTY #791

inkhey opened this issue Aug 24, 2024 · 3 comments

Comments

@inkhey
Copy link

inkhey commented Aug 24, 2024

Hello all, thanks for this nice software. I'm using pyinfra tool and wanted to provision fish with fisher and few plugins directly.

I go very straightforward, using the "server.script" function of pyinfra to run a simple fish script that does the fisher installation, using the one-line method…

…and it goes not very well. The process just hangs infinitely there, without any useful information.
After digging a bit, i discovered that the script doesn't seem to handle correctly a non-tty interface. I can reproduce the issue with a simple ssh -T:

`❯ ssh -T mymachine "fish -c \"set -l fish_trace on;curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher\""
> curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish
> source
--> function fisher --argument-names cmd --description 'A plugin manager for Fish'
--> if
--> set --query _fisher_upgraded_to_4_4
--> end if
> fisher install jorgebucaran/fisher
--> set --query fisher_path
--> set --local fisher_path /home/vagrant/.config/fish
--> set --local fisher_version 4.4.4
--> set --local fish_plugins /home/vagrant/.config/fish/fish_plugins
--> switch install
----> source /usr/share/fish/functions/isatty.fish
------> function isatty -d 'Tests if a file descriptor is a tty'
---> isatty
-----> set -l options h/help
-----> argparse -n isatty h/help --
-----> if
-----> set -q _flag_help
-----> end if
-----> if
-----> set -q 'argv[2]'
-----> end if
-----> set -l fd
-----> switch ''
------> set fd 0
-----> end switch
-----> test -t 0
---> read --local --null --array stdin
… hang here for the eternity

Is there any simple solution to this issue ?
Thanks.

@inkhey inkhey changed the title Unable to install fisher without a TTY. Unable to install fisher without a TTY Aug 24, 2024
@inkhey inkhey changed the title Unable to install fisher without a TTY Unable to install fisher without a proper TTY Aug 24, 2024
@jorgebucaran
Copy link
Owner

Probably related to:

isatty || read --local --null --array stdin && set --append argv $stdin

I really like that ability, but maybe we should remove it for 4.x unless there's a way to have our cake and eat it too.

Could you provide a simple script I can run to repro the issue? The code in your post is kind of unintelligible.

@inkhey
Copy link
Author

inkhey commented Aug 25, 2024

Probably related to:

isatty || read --local --null --array stdin && set --append argv $stdin

I really like that ability, but maybe we should remove it for 4.x unless there's a way to have our cake and eat it too.

Could you provide a simple script I can run to repro the issue? The code in your post is kind of unintelligible.

Currently, I don't see any simple way to execute in nontty/non-pty environment other than using ssh -T (maybe using tool like cron ?) :

If you have a local ssh server enabled, you can do this:

ssh -T localhost "fish ./install_fish.fish"

with install fish.fish file locally placed in you home dir:

#!/bin/fish
set -l fish_trace on;
isatty &&  echo "on a tty, don't continue" && exit 43
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fishe

I don't get the tty/pty stuff, but it's seems to be more related to unnexisting pseudo-terminal environment.

The ssh documentation say:

      -T      Disable pseudo-terminal allocation.

@jorgebucaran
Copy link
Owner

After looking into this further, it seems like this might be a dupe of #742. I'll close here and leave a comment there instead.

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

2 participants