Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

result.all is not constant #327

Closed
ehmicky opened this issue Jun 26, 2019 · 2 comments · Fixed by #330
Closed

result.all is not constant #327

ehmicky opened this issue Jun 26, 2019 · 2 comments · Fixed by #330

Comments

@ehmicky
Copy link
Collaborator

ehmicky commented Jun 26, 2019

Steps to reproduce:

import { promisify } from 'util'
import execa from 'execa'

(async () => {
  const childProcess = execa('echo', ['test'])
  await promisify(setTimeout)(1e3)

  console.log('all:', (await childProcess).all);
  console.log('all:', (await childProcess).all);
})()
$ node index.js
all: test
all: 

Node v12.4.0
Ubuntu 19.10
Execa 2.0.0

@ehmicky
Copy link
Collaborator Author

ehmicky commented Jun 26, 2019

I managed to reproduce this bug with this more minimal setup. It's based on what execa is internally doing.

const childProcess = require('child_process');
const getStream = require('get-stream');
const mergeStream = require('merge-stream');

(async () => {
	const {stdout} = childProcess.spawn('echo', ['test']);

	const all = mergeStream();
	all.add(stdout);

	console.log('all:', await getStream(all));
	console.log('all:', await getStream(all));
})();
$ node index.js
all: test

all:

@ehmicky
Copy link
Collaborator Author

ehmicky commented Jun 26, 2019

PR at #330.

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 a pull request may close this issue.

1 participant