Skip to content

Commit

Permalink
fix: stdin writing
Browse files Browse the repository at this point in the history
  • Loading branch information
Vehmloewff committed Mar 29, 2024
1 parent 3a0fc9f commit f570434
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
11 changes: 1 addition & 10 deletions sh.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { asserts } from './deps.ts'
import { execCaptureIncremental, sh } from './sh.ts'
import { execCaptureIncremental } from './sh.ts'

Deno.test("execCaptureIncremental doesn't fail or log anything extraneous", async () => {
await execCaptureIncremental(['deno', 'run', 'sh.ts'], {
Expand All @@ -21,12 +21,3 @@ Deno.test('execCaptureIncremental throws and error if child fails', async () =>
// it threw!
}
})

// this won't pass until deno fixes it's issue with inherit not actually inheriting
Deno.test({
name: 'sh stdout is inherited',
ignore: true,
async fn() {
await sh('echo "Deno.exit(Deno.stdout.isTerminal() && Deno.stderr.isTerminal() ? 0 : 1)" | deno')
},
})
5 changes: 3 additions & 2 deletions sh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ export async function execCaptureIncremental(segments: string[], options: ExecCa
: process.stderr.pipeThrough(new TextDecoderStream()).pipeThrough(new streamUtils.TextLineStream())

if (options.input) {
await process.stdin.getWriter().write(new TextEncoder().encode(options.input))
await process.stdin.close()
const writer = process.stdin.getWriter()
await writer.write(new TextEncoder().encode(options.input))
await writer.close()
}

const outputPromise = logLinesStream
Expand Down

0 comments on commit f570434

Please sign in to comment.