Skip to content

How to return back to the interactive shell directly from any function on the stack #8878

Closed Answered by ridiculousfish
MidAutumnMoon asked this question in Q&A
Discussion options

You must be logged in to vote

The only thing approximating non-local control flow is signal handling. This "sort of" works:

function child
	echo "Child ran"
	kill -INT $fish_pid 
	echo "This will not run"
end

function parent
	echo "Parent ran"
	child
	echo "This will not run either"
end

parent

and will restore interactive control. It runs into problems if the child function is in a pipeline, etc. but maybe this is good enough for your use case.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@MidAutumnMoon
Comment options

Answer selected by MidAutumnMoon
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants