Skip to content

Commit 7a2c94a

Browse files
committed
fix: memory handling of logs
1 parent a495f32 commit 7a2c94a

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/SQLLoader.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ public function execute(): ProcessResult
9393

9494
$this->result = Process::run($this->buildCommand());
9595

96-
if ($this->logPath && File::exists($this->logPath)) {
97-
$this->logs = File::get($this->logPath);
98-
}
99-
10096
if ($this->deleteFiles) {
97+
if ($this->logPath && File::exists($this->logPath)) {
98+
$this->logs = File::get($this->logPath);
99+
}
100+
101101
$this->deleteGeneratedFiles();
102102
}
103103

@@ -262,7 +262,15 @@ public function deleteFilesAfterRun(bool $delete = true): static
262262

263263
public function logs(): string
264264
{
265-
return $this->logs;
265+
if ($this->logs) {
266+
return $this->logs;
267+
}
268+
269+
if ($this->logPath && File::exists($this->logPath)) {
270+
return File::get($this->logPath);
271+
}
272+
273+
return 'No log file available';
266274
}
267275

268276
public function result(): ProcessResult

0 commit comments

Comments
 (0)