Commit cce2624
index.mjs
@@ -59,7 +59,9 @@ export function $(pieces, ...args) {
if (typeof $.cwd !== 'undefined') options.cwd = $.cwd
let child = exec($.prefix + cmd, options)
- process.stdin.pipe(child.stdin)
+ if (process.stdin.isTTY) {
+ process.stdin.pipe(child.stdin)
+ }
let stdout = '', stderr = '', combined = ''
child.stdout.on('data', data => {
test.mjs
@@ -88,10 +88,10 @@ import {strict as assert} from 'assert'
}
{ // Pipes are working
- // let {stdout} = await $`echo "hello"`
- // .pipe($`awk '{print $1" world"}'`)
- // .pipe($`tr '[a-z]' '[A-Z]'`)
- // assert(stdout === 'HELLO WORLD\n')
+ let {stdout} = await $`echo "hello"`
+ .pipe($`awk '{print $1" world"}'`)
+ .pipe($`tr '[a-z]' '[A-Z]'`)
+ assert(stdout === 'HELLO WORLD\n')
try {
let w = await $`echo foo`