From ab183c9fc67a21dcbc57ab20ce8769727123db72 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 17 Aug 2016 14:01:04 +0200 Subject: [PATCH] TaskServer-Steuerung: Temp-Datei automatisch entfernen lassen --- SL/System/TaskServer.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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)); -- 2.20.1