Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
sawirricardo committed Jun 20, 2023
1 parent b1f59bb commit f876be0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions resources/views/web-console/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
axios.post(`{{ $interactUrl ?? '' }}`, {
command: line,
working_directory: workingDirectory,
}).then((result) => {
}).then((res) => {
term.writeln(``);
if (result.output) {
if (res.data.output) {
commands = [...commands, line];
term.writeln(result.output);
term.writeln(res.data.output);
}
workingDirectory = result.working_directory
workingDirectory = res.data.working_directory
term.write(`${workingDirectory} => $ `)
})
}
Expand Down
8 changes: 4 additions & 4 deletions src/Http/Controllers/WebConsoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public function interact()
if ($cmd->substr(0, 2) == 'cd') {
if (chdir($cmd->substr(3))) {
return response()->json([
'output' => PHP_EOL,
'output' => "\r\n",
'working_directory' => getcwd(),
]);
}

return response()->json([
'output' => 'cd: Unable to change directory'.PHP_EOL,
'output' => 'cd: Unable to change directory'."\r\n",
'working_directory' => getcwd(),
]);
}
Expand All @@ -42,14 +42,14 @@ public function interact()

if ($output === false) {
return response()->json([
'output' => PHP_EOL,
'output' => "\r\n",
'working_directory' => getcwd(),
]);
}

return response()->json([
'output' => str($output)
->replace("\n", PHP_EOL)
->replace("\n", "\r\n")
->toString(),
'working_directory' => getcwd(),
]);
Expand Down

0 comments on commit f876be0

Please sign in to comment.