-
-
Notifications
You must be signed in to change notification settings - Fork 425
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
Expose execa Options for Configuring Its Child Process Spawning Behavior #1019
Comments
Would it make sense to expose an https://github.com/okonet/lint-staged#can-i-use-lint-staged-via-node |
@iiroj it would in general. By looking at the code, I wonder if the author wanted to have some behavior control on the execa (maybe to support the basic function of lint-staged). Otherwise, giving users full control on execa is the most straight-forward approach. :) |
Hello, the current
I can see the last option being problematic when overidden, but having a new |
@iiroj Interesting. With the consideration of Alternatively, if the change will allow configuring all execa options, I think one detailed debug message that highlights I'm not sure about the idea of unadvertised APIs. Personally, I'm not a fan of it. I usually find it discouraging and disappointing if some undocumented API is discovered after going through a whole bunch of code...Such API usually makes me hesitate to use it as well. :) |
Description
I try to use lint-staged to run a custom script. The script reads input from different source based on
process.stdin.isTTY
.The code structure is roughly like this:
However, when this script is invoked by lint-staged with configured command
node custome-script.js
, it wrongfully expects input fromprocess.stdin
while the input is fromprocess.argv
. This is due to how nodeJS's child_process module works: https://nodejs.org/api/child_process.html#child_process_options_stdioThe default
pipe
stdio option marksprocess.stdin.isTTY
false in spawned child process. Hence, my script gets confused and waits for input while letting lint-staged hang forever...I'd like to be able to adjust the child_process.spawn's behavior via lint-staged's configuration somehow.
Related code segment: https://github.com/okonet/lint-staged/blob/0ef25e81a150ae59749d28565b305c97ec932baa/lib/resolveTaskFn.js#L92-L105
Steps to reproduce
Try to invoke below script with lint-staged:
Debug Logs
N/A
Environment
lint-staged
: 11.1.2The text was updated successfully, but these errors were encountered: