#!/bin/sh . ./test-lib.sh t_plan 5 "at_exit/END handlers work as expected" t_begin "setup and startup" && { unicorn_setup cat >> $unicorn_config </dev/null 2>&1 do sleep 1 done } t_begin "check stderr" && check_stderr dbgcat r_err dbgcat r_out t_begin "all at_exit handlers ran" && { grep "$worker_pid BOTH" $r_out grep "$unicorn_pid BOTH" $r_out grep "$worker_pid END BOTH" $r_out grep "$unicorn_pid END BOTH" $r_out grep "$worker_pid WORKER ONLY" $r_out grep "$worker_pid END WORKER ONLY" $r_out } t_done