Skip to content

Commit 090d127

Browse files
committed
fix: use pipeline to catch errors
1 parent 4fbc36a commit 090d127

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"homepage": "https://github.com/rvagg/commit-stream",
2222
"devDependencies": {
2323
"list-stream": "^2.1.0",
24+
"readable-stream": "^4.3.0",
2425
"split2": "^4.2.0",
2526
"tape": "^5.6.3"
2627
},

test.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import { spawn, exec } from 'node:child_process'
33
import test from 'tape'
44
import split2 from 'split2'
55
import listStream from 'list-stream'
6+
import { pipeline } from 'readable-stream'
67

78
function gitToList (gitCmd, callback) {
89
const child = spawn('bash', ['-c', gitCmd])
9-
child.stdout
10-
.pipe(split2())
11-
.pipe(commitStream())
12-
.pipe(listStream.obj(callback))
10+
pipeline(
11+
child.stdout,
12+
split2(),
13+
commitStream(),
14+
listStream.obj(callback),
15+
() => {}
16+
)
1317
}
1418

1519
test('git is runnable', (t) => {

0 commit comments

Comments
 (0)