You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Calling a fish function from a git alias fails #1258
I have a fish function (~/.config/fish/functions/git-clean.fish) that I'm trying to call from a git alias set in my ~/.gitconfig.
The git alias is rm-untracked = !fish -c 'git-clean'.
The function works fine when called directly, calling it through the alias fails:
$ git rm-untracked # Calling function through Git alias fails
fish: Couldn't grab control of terminal
tcsetpgrp: Interrupted system call
$ git-clean # Calling function directly works
Would remove app/models/order.rb
Would remove db/migrate/20140121194853_create_orders.rb
Would remove test/factories/orders.rb
Would remove test/models/order_test.rb
Continue? [Yn]
> y
Removing app/models/order.rb
Removing db/migrate/20140121194853_create_orders.rb
Removing test/factories/orders.rb
Removing test/models/order_test.rb
That's basically what zsh calls "global aliases", and it won't work with fish's current approach, which is to have alias as a shortcut to defining functions.
I.e. that'd be a feature request, and not one that would be accepted, I think. Extending abbr might work, but that would then need a way to not expand.
Attempts to use tcsetpgrp() from a process which is a member of a background process group on a fildes associated with its controlling terminal shall cause the process group to be sent a SIGTTOU signal. If the calling thread is blocking SIGTTOU signals or the process is ignoring SIGTTOU signals, the process shall be allowed to perform the operation, and no signal is sent.
That sounds bananas to me, but it might be worth a go.
I can't really understand why fish is so insistent on being in its own process group; bash and zsh don't seem to bother in this situation.
This still doesn't work but the symptoms are now different. Probably due to the reworking of signal management I did recently. The fish process now blocks in the ioctl done by the tcsetpgrp() call done from reader_push() from builtin_read(). The act of dumping the call stack using a process debugger results in the shell exiting with the following output when the debugger detaches from the process:
<E> fish: Couldn't grab control of terminal
tcsetpgrp: Interrupted system call
I'm gonna declare this a duplicate of #3805. Both feature fish being unable to read as a result of being started from something else. I find 3805 has a nicer test case.
Activity
xiaogwu commentedon Apr 25, 2014
I would like to see this supported too.
faho commentedon Jul 17, 2015
I am guessing here you're trying to
readuser input in that function.Executing fish functions via git aliases works:
In ~/.config/fish/functions/ni.fish
alias is
ni = !fish -c 'ni'.Change ni to
and suddenly
git niyields:I'm not sure if this is a fish issue - seems like git doesn't connect stdin (or something).
pickfire commentedon Jul 19, 2015
And I hope alias in alias works too.
faho commentedon Jul 19, 2015
What do you mean? Using a fish-alias in a git-alias? That works too, since aliases are just functions.
pickfire commentedon Jul 21, 2015
a q -> asdf qwertyfaho commentedon Jul 21, 2015
That's basically what zsh calls "global aliases", and it won't work with fish's current approach, which is to have
aliasas a shortcut to defining functions.I.e. that'd be a feature request, and not one that would be accepted, I think. Extending
abbrmight work, but that would then need a way to not expand.zanchey commentedon Jul 24, 2015
Shortly after fish sets itself into its own process group,
tcsetpgrpgets SIGTTOU, which causes a return with EINTR.The POSIX documentation says:
That sounds bananas to me, but it might be worth a go.
I can't really understand why fish is so insistent on being in its own process group; bash and zsh don't seem to bother in this situation.
krader1961 commentedon Mar 23, 2017
This still doesn't work but the symptoms are now different. Probably due to the reworking of signal management I did recently. The fish process now blocks in the ioctl done by the
tcsetpgrp()call done fromreader_push()frombuiltin_read(). The act of dumping the call stack using a process debugger results in the shell exiting with the following output when the debugger detaches from the process:faho commentedon Jul 24, 2017
I'm gonna declare this a duplicate of #3805. Both feature fish being unable to
readas a result of being started from something else. I find 3805 has a nicer test case.