fix(traits): update saved_outputs handling in ExecuteRemoteCommand to use collection methods for better performance

This commit is contained in:
Andras Bacsai 2025-09-25 13:19:05 +02:00
parent 8f78c54cd3
commit 2eef83f072

View file

@ -202,13 +202,13 @@ private function executeCommandWithProcess($command, $hidden, $customType, $appe
if ($this->save) { if ($this->save) {
if (data_get($this->saved_outputs, $this->save, null) === null) { if (data_get($this->saved_outputs, $this->save, null) === null) {
data_set($this->saved_outputs, $this->save, str()); $this->saved_outputs->put($this->save, str());
} }
if ($append) { if ($append) {
$this->saved_outputs[$this->save] .= str($sanitized_output)->trim(); $current_value = $this->saved_outputs->get($this->save);
$this->saved_outputs[$this->save] = str($this->saved_outputs[$this->save]); $this->saved_outputs->put($this->save, str($current_value.str($sanitized_output)->trim()));
} else { } else {
$this->saved_outputs[$this->save] = str($sanitized_output)->trim(); $this->saved_outputs->put($this->save, str($sanitized_output)->trim());
} }
} }
}); });