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

Re: trap problem.



On Mar 29, 12:39pm, Tanaka Akira wrote:
} Subject: trap problem.
}
} trap doesn't work as follows.
} 
} % Src/zsh --version
} zsh 4.0.1-pre-2 (i386-unknown-freebsd4.2)
} % Src/zsh -fc 'trap "echo INT" INT; sleep 60'
} ^C
} %
} 
} It should print `INT' but it doesn't.

That's because zsh has been extremely clever and has `exec'd "sleep 60",
so there's no zsh process around any more to execute the trap.

Try:	Src/zsh -fc 'trap "echo INT" INT; sleep 60; sleep 1'

and you'll see ...

Perhaps zsh's tests for whether the last command can be `exec'd should
include testing whether there are any user-defined traps in effect?

-- 
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