Skip to content

Commit ab22618

Browse files
committed
pipe task stdout/stderr to files, see #88
1 parent 4649996 commit ab22618

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/utils/shell.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict'
22

3+
const fs = require('fs')
4+
const path = require('path')
35
const { spawn } = require('child_process')
46
const { tab } = require('../utils')
57

@@ -12,8 +14,8 @@ const shell = (cmd, opts = {}, logger) => {
1214
const myProcess = spawn(cmd[0], cmd.slice(1), opts)
1315

1416
myProcess.on('error', onError)
15-
myProcess.stdout.on('data', onStdout)
16-
myProcess.stderr.on('data', onStderr)
17+
myProcess.stdout.pipe(fs.createWriteStream(path.resolve(opts.cwd, 'stdout.txt')))
18+
myProcess.stderr.pipe(fs.createWriteStream(path.resolve(opts.cwd, 'stderr.txt')))
1719
myProcess.on('close', onClose)
1820
myProcess.on('disconnect', onDisconnect)
1921
myProcess.on('exit', onExit)

0 commit comments

Comments
 (0)