sub system_no_filehandles { my $pid = fork(); if ($pid) { waitpid($pid, 0); return $? } cleanup_all_filehandles(); cleanup_all_dirhandles(); exec(@_); }