Fix runHook error occured but exit status is 0