Skip to content

Commit

Permalink
Merge branch 'master' into t/73
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Piechaczek committed Nov 19, 2018
2 parents 4ce976e + 17206ac commit 5c11361
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "6"
- '8'
cache:
- node_modules
install:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

## [0.8.1](https://github.com/cksource/mgit2/compare/v0.8.0...v0.8.1) (2018-11-19)

### Bug fixes

* Mgit should end with proper exit code if some command failed. Closes [#86](https://github.com/cksource/mgit2/issues/86). ([b7b878b](https://github.com/cksource/mgit2/commit/b7b878b))


## [0.8.0](https://github.com/cksource/mgit2/compare/v0.7.5...v0.8.0) (2018-05-04)

### Features
Expand Down
13 changes: 13 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module.exports = function( args, options ) {

const processedPackages = new Set();
const commandResponses = new Set();
const packagesWithError = new Set();
const packageNames = getPackageNames( mgitOptions );

let allPackagesNumber = packageNames.length;
Expand Down Expand Up @@ -94,6 +95,10 @@ module.exports = function( args, options ) {
}

if ( returnedData.logs ) {
if ( returnedData.logs.error.length ) {
packagesWithError.add( packageName );
}

displayLog( packageName, returnedData.logs, {
current: donePackagesNumber,
all: allPackagesNumber,
Expand Down Expand Up @@ -123,6 +128,14 @@ module.exports = function( args, options ) {
const endTime = process.hrtime( startTime );

console.log( chalk.cyan( `Execution time: ${ endTime[ 0 ] }s${ endTime[ 1 ].toString().substring( 0, 3 ) }ms.` ) );

if ( packagesWithError.size ) {
const repositoryForm = packagesWithError.size === 1 ? 'repository' : 'repositories';
const message = `\n❗❗❗ The command failed to execute in ${ packagesWithError.size } ${ repositoryForm }.\n`;

console.log( chalk.red( message ) );
process.exit( 1 );
}
} );
}
};
2 changes: 0 additions & 2 deletions lib/utils/displaylog.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ module.exports = function displayLog( packageName, logs, options ) {
}

if ( errorLogs ) {
process.exitCode = 1;

console.log( chalk.red( errorLogs ) );
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mgit2",
"version": "0.8.0",
"version": "0.8.1",
"description": "A tool for managing projects build using multiple repositories.",
"keywords": [
"git",
Expand Down

0 comments on commit 5c11361

Please sign in to comment.