Skip to content

Commit

Permalink
fix(commit): fix windows commits by separating git add and commit exe…
Browse files Browse the repository at this point in the history
…cution

Windows cmd doesn't support separating commands with ';'. Fix by separating
the execution of the 'git add' and 'git commit' commands.

Fixes conventional-changelog#49
  • Loading branch information
Tapppi committed Jun 8, 2016
1 parent 4b2e9c7 commit 63f8450
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,21 @@ function commit (argv, newVersion, cb) {
args.unshift('package.json')
}
checkpoint(msg, args)
exec('git add package.json ' + argv.infile + ';git commit ' + verify + (argv.sign ? '-S ' : '') + 'package.json ' + argv.infile + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', function (err, stdout, stderr) {
var errMessage = null
if (err) errMessage = err.message
if (stderr) errMessage = stderr

function handleExecError (err, stderr) {
// If exec returns an error or content in stderr, log it and exit with return code 1
var errMessage = err || stderr
if (errMessage) {
console.log(chalk.red(errMessage))
process.exit(1)
}
return cb()
}
exec('git add package.json ' + argv.infile, function (err, stdout, stderr) {
handleExecError(err, stderr)
exec('git commit ' + verify + (argv.sign ? '-S ' : '') + 'package.json ' + argv.infile + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', function (err, stdout, stderr) {
handleExecError(err, stderr)
return cb()
})
})
}

Expand Down

0 comments on commit 63f8450

Please sign in to comment.