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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default value of stdin with $ #550

Merged
merged 1 commit into from Mar 14, 2023
Merged

Fix default value of stdin with $ #550

merged 1 commit into from Mar 14, 2023

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Mar 13, 2023

Fixes #549

This makes stdin of processes created with $ default to inherit instead of pipe, as this is most likely the intended behavior of users in that case.

This is technically a breaking change from 7.1.0. However, considering this is a very recent release and this is correcting the intended behavior, I am not sure whether we can consider 7.1.0's behavior a bug, i.e. this would be a bug fix instead? 馃

@@ -27,7 +27,7 @@ export type CommonOptions<EncodingType> = {

If you `$ npm install foo`, you can then `execa('foo')`.

@default `true` with `$`/`$.sync`, `false` otherwise
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think $.sync is implied by $, so I am not sure we need to be explicit there.

@sindresorhus
Copy link
Owner

This is technically a breaking change from 7.1.0. However, considering this is a very recent release and this is correcting the intended behavior, I am not sure whether we can consider 7.1.0's behavior a bug, i.e. this would be a bug fix instead?

I would see it as a bug-fix.

@sindresorhus
Copy link
Owner

Can you fix the merge conflict? Feel free to merge and release afterwards.

@ehmicky ehmicky merged commit 6fe7e51 into main Mar 14, 2023
20 checks passed
@ehmicky ehmicky deleted the fix-script-stdin branch March 14, 2023 19:20
@yuri-scarbaci-lenio
Copy link

yuri-scarbaci-lenio commented Jun 22, 2023

Just for the record,
this isn't only "technically" a breaking change,
this did actually have an impact in our implementation,

we have a scenario in which we use husky & wdio to run e2e test on a pre-push commit,
long story short:
wdio checks for the isTTY flag and makes an assumption based on that on the format of the piped-in values
husky/git pre-push hook are piping in "references"
execa change ( as expected but also in a breaking way) pipes in the "references" in stdin and that causes the flow we had to break

the change on our side was just clearly defining the flags for execa as

  {
     stdin: 'ignore',
     stdout: 'inherit',
     stderr: 'inherit',
   },

and this would bring the behaviour back to what we where previously doing before this PR was merged
(to be clear, in our own implementation we didn't expect any pipe-in at all from stdin, that's why the flag we used is ignore, in your case you may need to use pipe or handle it in some other way)

Leaving this here just for if anyone else is affected

some references:
https://git-scm.com/docs/githooks#_pre_push
https://github.com/webdriverio/webdriverio/blob/4cad54447a51d960914851477d365c29087791dd/packages/wdio-cli/src/commands/run.ts#L211

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.

Default stdin to inherit with $
3 participants