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

lib: improve option shell on child_process #27327

Closed
wants to merge 1 commit into from

Conversation

himself65
Copy link
Member

@himself65 himself65 commented Apr 20, 2019

fix #27120

shell add Array option to decode parameters

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the child_process Issues and PRs related to the child_process subsystem. label Apr 20, 2019
@himself65 himself65 marked this pull request as ready for review April 21, 2019 01:09
Copy link
Member

@ZYSzys ZYSzys left a comment

Choose a reason for hiding this comment

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

This should need some tests.

@himself65
Copy link
Member Author

yes, i will

but i’m thinking if this solution is the good way

@BridgeAR
Copy link
Member

@nodejs/child_process do we maybe want to make this OS agnostic and rename this to shellParameters? That way we'd have a unified way to pass flags to the shell.

@refack
Copy link
Contributor

refack commented Apr 21, 2019

@nodejs/child_process do we maybe want to make this OS agnostic and rename this to shellParameters? That way we'd have a unified way to pass flags to the shell.

I was thinking about an even more generic approach; make shell take an array value so that

  1. exec('"/path/to/test file/test.sh" arg1 arg2');
    Uses default shell with default cli arg
  2. exec('"/path/to/test file/test.sh" arg1 arg2', { shell: 'bash' });
    Uses specified shell with default cli arg
  3. exec('"/path/to/test file/test.sh" arg1 arg2',  { shell: ['bash', '-xe', '-x'] });
    Uses specified shell with specified cli arg

@refack refack added the semver-minor PRs that contain new features and should be released in the next minor version. label Apr 21, 2019
@refack
Copy link
Contributor

refack commented Apr 21, 2019

P.S. @himself65, thank you very much for taking this on 🎩

P.P.S. This will need a new test case. IMHO it could fit somewhere above this condition

// This test is only relevant on Windows.
if (!common.isWindows)
common.skip('Windows specific test.');

@BridgeAR
Copy link
Member

@refack I like the array notation. I think that's even a better approach than adding a new option.

@himself65 himself65 changed the title lib: add option windowsCmdParameters on child_process lib: improve option shell on child_process Apr 22, 2019
@himself65
Copy link
Member Author

himself65 commented Apr 22, 2019

I try

@himself65
Copy link
Member Author

himself65 commented Apr 23, 2019

@BridgeAR @refack

I have done the solution of array notation. Any reviews?

Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

We have to document the new behavior properly (this is especially important on Windows). Other than that it's LGTM % nits.

lib/child_process.js Outdated Show resolved Hide resolved
@BridgeAR
Copy link
Member

The code itself LGTM. We just have to update the documentation to include the information and also add an changes entry to the docs that highlights when this feature was added.

@himself65
Copy link
Member Author

hmmm, let me update the documentation? but I am not good at this.

@gireeshpunathil
Copy link
Member

@himself65 - this needs a rebase now

doc/api/child_process.md Outdated Show resolved Hide resolved
@himself65
Copy link
Member Author

rebased

@aduh95
Copy link
Contributor

aduh95 commented Nov 8, 2020

@himself65 this needs a rebase.

@aduh95 aduh95 added the stalled Issues and PRs that are stalled. label Nov 8, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2020

This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2021

Closing this because it has stalled. Feel free to reopen if this PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions.

@github-actions github-actions bot closed this Jan 9, 2021
@Taitava
Copy link

Taitava commented Jul 23, 2022

Could this be checked again? 🙂 I don't have the technical knowledge regarding developing Node.js, so I don't know what actually needs to be done, but I would be interested in the ability to define shell parameters.

Thanks! 🌞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem. semver-minor PRs that contain new features and should be released in the next minor version. stalled Issues and PRs that are stalled.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use the /q flag with cmd.exe in child_process.spawn()
9 participants