Skip to content

Commit

Permalink
Register a shutdown function to close our custom streams for us.
Browse files Browse the repository at this point in the history
  • Loading branch information
John P. Bloch committed Jun 26, 2012
1 parent a6aa412 commit adc83b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/cli/Streams.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ public static function setStream( $whichStream, $stream ) {
if( property_exists( __CLASS__, $whichStream ) ) {
static::${$whichStream} = $stream;
}
register_shutdown_function( function() use ($stream) {
fclose( $stream );
} );
}

}

0 comments on commit adc83b3

Please sign in to comment.