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

exit inside fish_prompt function doesn't exit immediately #8033

Closed
rnhmjoj opened this issue May 27, 2021 · 7 comments
Closed

exit inside fish_prompt function doesn't exit immediately #8033

rnhmjoj opened this issue May 27, 2021 · 7 comments
Labels
bug Something that's not working as intended
Milestone

Comments

@rnhmjoj
Copy link
Contributor

rnhmjoj commented May 27, 2021

Issue description

When the exit command is executed inside fish_prompt, the shell doesn't exit unless some a command is typed and executed (pressing enter alone doesn't work).

Steps to reproduce:

set config.sh to

function fish_prompt
  echo '$ '
  exit
end

run fish and notice it doesn't exit.

Commit that introduced the issue

b018218 (Rework exit command)

@rnhmjoj
Copy link
Contributor Author

rnhmjoj commented May 27, 2021

I'm doing so because I have a "launcher" mode where the shell exits after executing a single command.

@faho
Copy link
Member

faho commented May 27, 2021

I'm doing so because I have a "launcher" mode where the shell exits after executing a single command.

That's what fish -c 'command' is for.

@zanchey
Copy link
Member

zanchey commented May 27, 2021

The current behaviour is interestingly broken, though, and I think should be fixed.

@zanchey zanchey added the bug Something that's not working as intended label May 27, 2021
@zanchey zanchey added this to the fish-future milestone May 27, 2021
@rnhmjoj
Copy link
Contributor Author

rnhmjoj commented May 27, 2021

That's what fish -c 'command' is for.

I mean I'm using the shell as a launcher, so I need interactivity. It's like a shell session but it closes before drawing the prompt a second time.

@faho
Copy link
Member

faho commented May 27, 2021

I mean I'm using the shell as a launcher, so I need interactivity.

That's

fish -c 'read -P "PROMPT " --shell -l command; eval $command'

@rnhmjoj
Copy link
Contributor Author

rnhmjoj commented May 27, 2021

Thank you, I didn't know about read --shell. This solves my problem, the bug is still relevant, though.

@ridiculousfish
Copy link
Member

Fixed in ba2e7db. Neat find.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

4 participants