Skip to content

Commit bd92153

Browse files
committed
Util: Drive all command invocation through Release.(raw)Exec
1 parent cb14b9b commit bd92153

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

lib/git.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ module.exports = function( Release ) {
22

33
Release.define({
44
gitLog: function( format ) {
5-
var command = "git log " + Release.prevVersion + ".." + Release.newVersion + " " +
6-
"--format=\"" + format + "\"",
5+
var commitRange = Release.prevVersion + ".." + Release.newVersion,
6+
gitLog = "git log --format=\"" + format + "\" " + commitRange,
77
result = Release.exec({
8-
command: command,
8+
command: gitLog,
99
silent: true
10-
}, "Error getting git log, command was: " + command );
10+
}, "Error getting git log, command was: " + gitLog );
1111

1212
result = result.split( /\r?\n/ );
1313
if ( result[ result.length - 1 ] === "" ) {

lib/npm.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
var chalk = require( "chalk" ),
2-
shell = require( "shelljs" );
1+
var chalk = require( "chalk" );
32

43
module.exports = function( Release ) {
54
Release.define({
@@ -17,7 +16,7 @@ module.exports = function( Release ) {
1716
},
1817

1918
_getNpmOwners: function( npmPackage ) {
20-
var result = shell.exec( "npm owner ls " + npmPackage, { silent: true } );
19+
var result = Release.rawExec( "npm owner ls " + npmPackage, { silent: true } );
2120
if ( result.code !== 0 ) {
2221

2322
// The npm package may not exist yet

lib/util.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ var shell = require( "shelljs" ),
44
module.exports = function( Release ) {
55

66
Release.define({
7+
rawExec: function( command, options ) {
8+
return shell.exec( command, options );
9+
},
10+
711
exec: function( _options, errorMessage ) {
812
var result,
913
command = _options.command || _options,
@@ -15,7 +19,7 @@ Release.define({
1519

1620
errorMessage = errorMessage || "Error executing command: " + command;
1721

18-
result = shell.exec( command, options );
22+
result = Release.rawExec( command, options );
1923
if ( result.code !== 0 ) {
2024
Release.abort( errorMessage );
2125
}

0 commit comments

Comments
 (0)