zsh-users
 help / color / mirror / code / Atom feed
* read still active after Ctrl-C
@ 2016-06-02  6:19 Sebastian Gniazdowski
  2016-06-02  9:32 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2016-06-02  6:19 UTC (permalink / raw)
  To: Zsh Users

Hello,
how to leave whole script on Ctrl-C? Below is a simple example where
read is still active and waits for a key after Ctrl-C is pressed

#!/usr/bin/env zsh

trap "endprog; exit" TERM INT QUIT
trap "endprog" EXIT

endprog() {
    echo "Am called"
}

wait_for_any_key() {
    read -rs -k 1 -t "$1"
}

wait_for_any_key 60 && exit


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-02  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-02  6:19 read still active after Ctrl-C Sebastian Gniazdowski
2016-06-02  9:32 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).