Fix ProcessRunner

This commit is contained in:
Anton Medvedev 2021-11-05 15:47:54 +01:00
parent b40c641ee2
commit 704af44600
4 changed files with 4 additions and 4 deletions

View File

@ -234,7 +234,7 @@ runLocally("echo $user");
- **idle_timeout** `int|null` — Sets the process idle timeout (max. time since last output) in seconds.
- **secret** `string|null` — Placeholder `%secret%` can be used in command. Placeholder will be replaced with this value and will not appear in any logs.
- **env** `array|null` — Array of environment variables: `runLocally('echo $KEY', env: ['key' => 'value']);`
- **shell** `string|null` — Shell to run in. Default is `bash -c`.
- **shell** `string|null` — Shell to run in. Default is `bash -s`.
## test()

View File

@ -38,7 +38,7 @@ class ProcessRunner
'idle_timeout' => null,
'cwd' => defined('DEPLOYER_ROOT') ? DEPLOYER_ROOT : null,
'real_time_output' => false,
'shell' => 'bash -c',
'shell' => 'bash -s',
];
$config = array_merge($defaults, $config);

View File

@ -401,7 +401,7 @@ function run(string $command, ?array $options = [], ?int $timeout = null, ?int $
* @param int|null $idle_timeout Sets the process idle timeout (max. time since last output) in seconds.
* @param string|null $secret Placeholder `%secret%` can be used in command. Placeholder will be replaced with this value and will not appear in any logs.
* @param array|null $env Array of environment variables: `runLocally('echo $KEY', env: ['key' => 'value']);`
* @param string|null $shell Shell to run in. Default is `bash -c`.
* @param string|null $shell Shell to run in. Default is `bash -s`.
*
* @throws RunException
*/

View File

@ -5,7 +5,7 @@ namespace Deployer;
require_once __DIR__ . '/hosts.php';
task('test:misc:sudo-write-user', function (): void {
$cmd = 'sudo bash -c \'echo Current user is: $USER\'';
$cmd = 'sudo bash -s \'echo Current user is: $USER\'';
$output = run($cmd);
writeln($output);
})->shallow();