From: Moritz Bunkus Date: Wed, 17 Aug 2016 12:01:04 +0000 (+0200) Subject: TaskServer-Steuerung: Temp-Datei automatisch entfernen lassen X-Git-Tag: release-3.5.4~2131 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ab183c9fc67a21dcbc57ab20ce8769727123db72;p=kivitendo-erp.git TaskServer-Steuerung: Temp-Datei automatisch entfernen lassen --- diff --git a/SL/System/TaskServer.pm b/SL/System/TaskServer.pm index f5b412274..e410e7311 100644 --- a/SL/System/TaskServer.pm +++ b/SL/System/TaskServer.pm @@ -10,7 +10,7 @@ use Rose::Object::MakeMethods::Generic ( use File::Slurp; use File::Spec::Functions qw(:ALL); -use File::Temp qw(tempfile); +use File::Temp; use SL::System::Process; @@ -82,12 +82,13 @@ sub _read_pid { sub _run_script_command { my ($self, $command) = @_; - my ($fh, $file_name) = tempfile(); my $exe = catfile(catdir(SL::System::Process->exe_dir, 'scripts'), 'task_server.pl'); + my $temp_file = File::Temp->new; + my $file_name = $temp_file->filename; - system "${exe} ${command} >> ${file_name} 2>&1"; + $temp_file->close; - $fh->close; + system "${exe} ${command} >> ${file_name} 2>&1"; $self->last_command_output(read_file($file_name));