PHP finally blocks not run on exit

I confirmed with the following code that if you call ‘exit’ withing a ‘try’ block the ‘finally’ block does *not* execute. That’s probably what you would expect. But now we know.

register_shutdown_function( 'handle_shutdown' );

try {


catch ( Exception $ex ) {

  echo "caught...\n";

finally {

  echo "finally...\n";


function handle_shutdown() {

  echo "shutdown...\n";


Error: post-commit hook failed (exit code 255) with no output

In subversion I was getting the error “post-commit hook failed (exit code 255) with no output” after trying to configure my post-commit hook to send email notifications. At first I thought the problem must have been related to the mailer, but I ran the mail command manually and it worked fine. Eventually I figured out that the problem was that the hooks/post-commit file hadn’t been marked executable. So it was a simple chmod +x to fix the problem.

Bash wait

Today I learned about the ‘wait’ command. It waits for background processes to terminate before returning, so you can fire off a bunch of jobs to be run in parallel and then wait for all of them to complete before continuing, like in this script I wrote tonight:

if [ -n "$1" ]; then
  pushd "$1" > /dev/null 2>&1
  if [ "$?" -ne "0" ]; then
    echo "Cannot change dir to '$1'.";
    exit 1;
sudo chown -R jj5:jj5 . &
sudo find . -type d -exec chmod u+rwx {} \; &
sudo find . -type f -exec chmod u+rw {} \; &
if [ -n "$1" ]; then
  popd > /dev/null 2>&1
exit 0