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

Re: trap signal with functional scope?



On Sep 5,  2:08pm, Peter Stephenson wrote:
} Subject: Re: trap signal with functional scope?
}
} Sebastian Stark wrote:
} > 
} > ssh () {
} >          set_screen_title ${*##-*}
} >          command ssh "$@"
} >          set_screen_title "${HOST/.*}"
} > }
} > 
} > Most of the time this just works and is cool. It fails when I send  
} > ctrl-c to the ssh process.
} 
} Without a suitably recent version of zsh, the answer is probably to
} upgrade.

Isn't this what "setopt localtraps" is for?

    ssh () {
      setopt localtraps
      trap ':' INT
      set_screen_title ${*##-*}
      command ssh "$@"
      set_screen_title "${HOST/.*}"
    }

If your zsh isn't recent enough to have localtraps, see above.



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