And I just gave myself an idea for an implementation: function suspend if status --is-login echo cannot suspend login shell >&2 else kill -STOP %self end end
Seems to work like a charm. Unless someone objects before I get back to a terminal, I'll submit a pull request for this. On Tue, Aug 4, 2015 at 3:16 AM Mike Meyer <m...@mired.org> wrote: > And to answer the implied question - C-Z isn't a fish thing, it's a tty > driver thing. It sends a TSTP signal to the controlling process. The > default action is to suspend the process, and transfer control back to the > first ancestor does some kind of job control. But you can get the same > effect with a kill -STOP. Job control is the fish feature you just > demonstrated. > > On Tue, Aug 4, 2015 at 3:08 AM Mike Meyer <m...@mired.org> wrote: > >> On Tue, Aug 4, 2015 at 2:14 AM Diego Zamboni <di...@zzamboni.org> wrote: >> >>> Hi Mike, >>> >>> There doesn't seem to be a way to suspend a fish shell, ala the >>> "suspend" builtin in zsh, bash, etc. I'm wondering if this is a bug, and >>> C-Z should work (except in a login shell), or if it's a design feature. or >>> if no one has asked for it? >>> >>> >>> It works for me: >>> >>> diego@cuper➜ sleep 50 >>> <press Ctrl-Z> >>> 'sleep 50' has stopped >>> diego@cuper➜ jobs >>> Job Group State Command >>> 1 53568 stopped sleep 50 >>> diego@cuper➜ bg >>> Send job 1 'sleep 50' to background >>> diego@cuper➜ fg >>> Send job 1, 'sleep 50' to foreground >>> ^C~ >>> >> >> That's not suspending the shell, the shell, that's suspending to the >> shell. Using bash as an example, since fish apparently doesn't do this: >> >> bhuda% bash >> [mwm@bhuda ~/src/chiselapp/straight]$ pwd >> /export/mwm/src/chiselapp/straight >> [mwm@bhuda ~/src/chiselapp/straight]$ jobs >> [mwm@bhuda ~/src/chiselapp/straight]$ suspend >> 'bash' has stopped >> bhuda% jobs >> ~/src/chiselapp/straight|fs:trunk@75f77 >> Job Group State Command >> 1 27193 stopped bash >> bhuda% >> >> See the difference? Being able to suspend a shell is a pretty standard >> feature: >> >> bhuda% jobs >> Job Group State Command >> 5 27790 stopped bltsh >> 4 27719 stopped zsh >> 3 27702 stopped bash >> 2 27684 stopped csh >> 1 27666 stopped tcsh >> bhuda% >> >> The only other shell I could find that couldn't be suspended was /bin/sh, >> which is based on ash. >> >> Most programs that aren't shells will catch C-Z to suspend, but the only >> one of the above that does that is bltsh, and it's really more a tcl >> interpreter than a shell. The others all have a "suspend" command that >> suspends them back to whatever program launched them. Unless they're a >> login shell, in which case it's usually disabled. >> >
------------------------------------------------------------------------------
_______________________________________________ Fish-users mailing list Fish-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fish-users