fix: append command history row in real-time after execution

This commit is contained in:
2026-06-14 09:12:28 -04:00
parent 49d724cf9c
commit b7bd4bfe92
2 changed files with 34 additions and 1 deletions

View File

@@ -100,7 +100,7 @@ class TerminalController
$ssh->disconnect();
$commandHistory = new CommandHistory();
$commandHistory->log(
$historyId = $commandHistory->log(
$id,
Session::get('user_id'),
$command,
@@ -115,6 +115,13 @@ class TerminalController
'output' => $result['output'],
'exit_status' => $result['exit_status'],
'stderr' => $result['stderr'],
'history' => [
'id' => $historyId,
'command' => $command,
'exit_status' => $result['exit_status'] ?? 0,
'executed_at' => date('Y-m-d H:i:s'),
'username' => Session::get('username'),
],
]);
} catch (\Throwable $e) {
$this->view->json([