Skip to content

fix: mixin ProcessOutput data to promisified pipe value#954

Merged
antonmedv merged 1 commit intogoogle:mainfrom
antongolub:mix-proc-output-to-p-stream
Nov 24, 2024
Merged

fix: mixin ProcessOutput data to promisified pipe value#954
antonmedv merged 1 commit intogoogle:mainfrom
antongolub:mix-proc-output-to-p-stream

Conversation

@antongolub
Copy link
Copy Markdown
Collaborator

continues #949

Promisified pipe result exposes the closest left ProcessOutput data for backward compatibility

const file = tempfile()
const fileStream = fs.createWriteStream(file)
const p = $`echo "hello"`
  .pipe(getUpperCaseTransform())
  .pipe(fileStream)
const o = await p

assert.ok(p instanceof WriteStream)
assert.ok(o instanceof WriteStream)
assert.equal(o.stdout, 'hello\n')
assert.equal(o.exitCode, 0)
assert.equal((await fs.readFile(file)).toString(), 'HELLO\n')
  • Tests pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants