Skip to content

Commit

Permalink
Fix spawn command context. (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima authored May 23, 2021
1 parent a4bf362 commit eedfc36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/spawn-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const spawnCommand = module.exports;
* @param {object} [opt] any execa options
* @return {String} spawned process reference
*/
spawnCommand.spawnCommand = (command, args, opt) => {
spawnCommand.spawnCommand = function (command, args, opt) {
return spawn(command, args, {stdio: 'inherit', cwd: this.cwd, ...opt});
};

Expand All @@ -27,6 +27,6 @@ spawnCommand.spawnCommand = (command, args, opt) => {
* @param {object} [opt] any execa options
* @return {String} spawn.sync result
*/
spawnCommand.spawnCommandSync = (command, args, opt) => {
spawnCommand.spawnCommandSync = function (command, args, opt) {
return spawn.sync(command, args, {stdio: 'inherit', cwd: this.cwd, ...opt});
};
5 changes: 3 additions & 2 deletions test/spawn-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ describe('environment (spawn-command)', () => {
beforeEach(function () {
this.spawnLib = sinon.stub();
this.spawnLib.sync = sinon.stub();
this.spawn = proxyquire('../lib/spawn-command', {
this.spawn = {};
Object.assign(this.spawn, proxyquire('../lib/spawn-command', {
execa: this.spawnLib
});
}));
cwd = Math.random().toString(36).slice(7);
this.spawn.cwd = cwd;
});
Expand Down

0 comments on commit eedfc36

Please sign in to comment.