Skip to content

Commit

Permalink
pipe task stdout/stderr to files, see #88
Browse files Browse the repository at this point in the history
  • Loading branch information
thejmazz committed Sep 17, 2017
1 parent 4649996 commit ab22618
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/utils/shell.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

const fs = require('fs')
const path = require('path')
const { spawn } = require('child_process')
const { tab } = require('../utils')

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

myProcess.on('error', onError)
myProcess.stdout.on('data', onStdout)
myProcess.stderr.on('data', onStderr)
myProcess.stdout.pipe(fs.createWriteStream(path.resolve(opts.cwd, 'stdout.txt')))
myProcess.stderr.pipe(fs.createWriteStream(path.resolve(opts.cwd, 'stderr.txt')))
myProcess.on('close', onClose)
myProcess.on('disconnect', onDisconnect)
myProcess.on('exit', onExit)
Expand Down

0 comments on commit ab22618

Please sign in to comment.