Skip to content

Commit 3c69935

Browse files
committed
corrections, update test
1 parent 9e49261 commit 3c69935

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,11 @@ export const spawning = Sys.spawning = function (command, argument, progressOpti
188188
};
189189

190190
let progress = progressOptions;
191-
if (typeof progressOptions == 'object' && !isFunction(progressOptions)) {
191+
if (typeof progressOptions == 'object' && !isFunction(progressOptions))
192192
options = Object.assign(options, progressOptions);
193-
progress = options.onprogress || null;
194-
} else if (isFunction(options.onprogress)) {
193+
194+
if (isFunction(options.onprogress))
195195
progress = options.onprogress;
196-
}
197196

198197
let err = null;
199198
let output = null;

test/test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,21 @@ describe('Method: `spawning`', function () {
321321
done();
322322
});
323323
});
324+
325+
it('should return on successful from `onprogress`', function (done) {
326+
spawning((process.platform == 'win32' ? 'dir' : 'ls'), ['..'], null, {
327+
stdio: 'pipe',
328+
shell: true,
329+
onprogress: (object) => {
330+
expect(object.output).to.be.a('string');
331+
return 'done';
332+
}
333+
})
334+
.then(function (data) {
335+
expect(data).to.equal('done');
336+
done();
337+
});
338+
});
324339
});
325340

326341
describe('Method: `where`', function () {

0 commit comments

Comments
 (0)