Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: signals in loops



On Oct 21, 10:49pm, bperkins@xxxxxxxxxxxx wrote:
} Subject: signals in loops
}
} I've been using zsh for a while, and I'd swear you used to be able to
} do this:
} 
} for foo in 1 2 3 4 5 6 ; do xmessage $foo; done
} 
} and you could give control-c to kill the xmessage and the next one
} would pop up.

Yes, you did used to be able to do that.  It was a bug. :-)  To see why
it was a bug, consider trying to interrupt this:

	while : ; do something; done

} Which brings up a mostly acidemic question, what is the default
} "trap?"

There isn't any way to write the default signal handling behavior in the
shell language.  Effectively you're correct that it breaks from all loops
on the INT or QUIT signals.

On the TSTP signal, recent versions of zsh implicitly force the entire
loop into a subshell in order to be able to stop it.  Forking that sub-
shell is delayed until the signal is actually received.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author