mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 18:01:37 +00:00
Fix console working directory for root user (#525)
Previously, `$(pwd)` was expanded too early by the parent shell, leading to incorrect working directory output when `cd` was executed within `$request->command`. Replaced `echo "VITO_WORKING_DIR: $(pwd)"` with `echo -n "VITO_WORKING_DIR: " && pwd` to ensure `pwd` executes at the right moment inside the same shell session. Closes #515
This commit is contained in:
parent
97e20206e8
commit
49137a757b
@ -37,7 +37,7 @@ public function run(Server $server, Request $request)
|
||||
|
||||
return response()->stream(
|
||||
function () use ($server, $request, $ssh, $log, $currentDir) {
|
||||
$command = 'cd '.$currentDir.' && '.$request->command.' && echo "VITO_WORKING_DIR: $(pwd)"';
|
||||
$command = 'cd '.$currentDir.' && '.$request->command.' && echo -n "VITO_WORKING_DIR: " && pwd';
|
||||
$output = '';
|
||||
$ssh->exec(command: $command, log: $log, stream: true, streamCallback: function ($out) use (&$output) {
|
||||
echo preg_replace('/^VITO_WORKING_DIR:.*(\r?\n)?/m', '', $out);
|
||||
|
Loading…
x
Reference in New Issue
Block a user