Skip to content

Commit

Permalink
Merge pull request #41 from danielbachhuber/39-use-pipefail
Browse files Browse the repository at this point in the history
Set 'pipefail' to properly report status of `composer update`
  • Loading branch information
danielbachhuber authored Feb 5, 2020
2 parents e741f74 + a67c796 commit 5ec0740
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ public static function check_executables( \stdClass $provider ) {
}
}
Logger::info( 'Found required executables on system: ' . implode( ', ', $execs ) );

$output = shell_exec( 'set -o' );
if ( false !== stripos( $output, 'pipefail' ) ) {
Logger::info( 'Found required pipefail option in shell.' );
} else {
Logger::error( "Missing required 'pipefail' option in shell." );
}
}

public static function get_config() {
Expand Down
2 changes: 1 addition & 1 deletion src/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private function runComposerInstall() {
*/
private function runComposerUpdate() {
$args = getenv( 'CLU_COMPOSER_UPDATE_ARGS' ) ? : '--no-progress --no-dev --no-interaction';
$cmd = 'composer update ' . $args . ' 2>&1 | tee vendor/update.log';
$cmd = 'set -o pipefail && composer update ' . $args . ' 2>&1 | tee vendor/update.log';
Logger::info( $cmd );
exec( $cmd, $output, $return_code );
if ( 0 !== $return_code ) {
Expand Down

0 comments on commit 5ec0740

Please sign in to comment.