diff options
| author | fukachan <fukachan> | 2004-11-30 04:14:59 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-11-30 04:14:59 +0000 |
| commit | 968cb03a8eacc447e78f01b0c12ce4eaeea53d4b (patch) | |
| tree | 2cdc7f4905e7c3a27a77877facfeb3a9203f6a74 | |
| parent | ad4b8945a143a42f4642f3d6fb2236e2890022df (diff) | |
| download | fml8-968cb03a8eacc447e78f01b0c12ce4eaeea53d4b.tar.gz fml8-968cb03a8eacc447e78f01b0c12ce4eaeea53d4b.tar.bz2 fml8-968cb03a8eacc447e78f01b0c12ce4eaeea53d4b.zip | |
temp_file_path() automatically push the returned value (file path)
into the clean up queue. Files of the queue are removed at the last of
the current process.
| -rw-r--r-- | fml/lib/FML/Process/Kernel.pm | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm index 8a2ac12f..95423384 100644 --- a/fml/lib/FML/Process/Kernel.pm +++ b/fml/lib/FML/Process/Kernel.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Kernel.pm,v 1.242 2004/11/23 04:22:00 fukachan Exp $ +# $FML: Kernel.pm,v 1.243 2004/11/25 12:25:56 fukachan Exp $ # package FML::Process::Kernel; @@ -2587,8 +2587,6 @@ sub _append_rfc822_message else { $curproc->logerror("_append_rfc822_message: cannot open \$tmpfile"); } - - $curproc->add_into_clean_up_queue( $tmpfile ); } else { $curproc->logerror("_append_rfc822_message: \$tmpfile not found"); @@ -2600,7 +2598,7 @@ sub _append_rfc822_message # Arguments: OBJ($curproc) STR($file) # Side Effects: update $curproc->{ __clean_up_tmpfiles }; # Return Value: none -sub add_into_clean_up_queue +sub _add_into_clean_up_queue { my ($curproc, $file) = @_; my $queue = $curproc->{ __clean_up_tmpfiles }; @@ -2625,7 +2623,7 @@ sub clean_up_tmpfiles if (defined $queue) { for my $q (@$queue) { - $curproc->log("unlink $q") if $debug; + $curproc->log("unlink $q"); unlink $q; } } @@ -2663,12 +2661,16 @@ sub temp_file_path if (-d $tmp_dir && -w $tmp_dir) { use File::Spec; - return File::Spec->catfile($tmp_dir, $f); + my $_file = File::Spec->catfile($tmp_dir, $f); + $curproc->_add_into_clean_up_queue($_file); + return $_file; } else { my $tmp_dir = $curproc->global_tmp_dir_path(); use File::Spec; - return File::Spec->catfile($tmp_dir, $f); + my $_file = File::Spec->catfile($tmp_dir, $f); + $curproc->_add_into_clean_up_queue($_file); + return $_file; } } @@ -2902,7 +2904,6 @@ sub _reopen_stderr_channel $pcb->set("stderr", "use_log_dup", 1); open(STDERR, "> $tmpfile") || croak("fail to open $tmpfile"); - $curproc->add_into_clean_up_queue($tmpfile); } } |
