Skip to content

Commit e7559fc

Browse files
committed
Add stdout/stderr option
Signed-off-by: Riddhesh Sanghvi <[email protected]>
1 parent d4371c1 commit e7559fc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

php/class-ee-docker.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,12 @@ public static function docker_compose_up( $dir, $services = [] ) {
209209
* @param bool $shell_wrapper If shell wrapper should be enabled or not.
210210
* @param bool $exit_on_error To exit or not on error.
211211
* @param array $exec_obfuscate Data to be obfuscated from log.
212+
* @param bool $echo_stdout Output stdout of exec if true.
213+
* @param bool $echo_stderr Output stderr of exec if true.
212214
*
213215
* @return bool success.
214216
*/
215-
public static function docker_compose_exec( $command = '', $service = '', $shell = 'sh', $user = '', $dir = '', $shell_wrapper = false, $exit_on_error = false, $exec_obfuscate = [] ) {
217+
public static function docker_compose_exec( $command = '', $service = '', $shell = 'sh', $user = '', $dir = '', $shell_wrapper = false, $exit_on_error = false, $exec_obfuscate = [], $echo_stdout = false, $echo_stderr = false ) {
216218

217219
if ( ! empty( $dir ) ) {
218220
$chdir_return_code = chdir( $dir );
@@ -231,9 +233,9 @@ public static function docker_compose_exec( $command = '', $service = '', $shell
231233
}
232234

233235
if ( $shell_wrapper ) {
234-
return EE::exec( \EE_DOCKER::docker_compose_with_custom() . " exec $tty $user_string $service $shell -c \"$command\"", true, true, $exec_obfuscate, $exit_on_error );
236+
return EE::exec( \EE_DOCKER::docker_compose_with_custom() . " exec $tty $user_string $service $shell -c \"$command\"", $echo_stdout, $echo_stderr, $exec_obfuscate, $exit_on_error );
235237
} else {
236-
return EE::exec( \EE_DOCKER::docker_compose_with_custom() . " exec $tty $user_string $service $command", true, true, $exec_obfuscate, $exit_on_error );
238+
return EE::exec( \EE_DOCKER::docker_compose_with_custom() . " exec $tty $user_string $service $command", $echo_stdout, $echo_stderr, $exec_obfuscate, $exit_on_error );
237239
}
238240

239241
}

0 commit comments

Comments
 (0)