Git Product home page Git Product logo

Comments (7)

satazor avatar satazor commented on May 14, 2024

So basically, using cmd.exe makes the spawn a lot slower if I understood correctly. The detection to whether use cmd or not must be clever. There's tooling such as del that are only available when running with the windows shell.

If it doesn't cause any harm, I'm willing to say it's a good idea.

from node-cross-spawn.

timdp avatar timdp commented on May 14, 2024

del might be quite easy to cover: we'd spawn cmd.exe by default and only bypass it if the file extension is in the whitelist (basically .exe and .com, I think). However, that'll mean that we also spawn a shell for commands that don't specify the extension, which will be the vast majority of cross-platform code.

Alternatively, perhaps we should maintain a list of commands included in the output of cmd's help command?

Another question is, should cross-spawn support del by default (i.e., without a proprietary option)? It's not spawning del, it's spawning cmd and running its del command, so the behavior is somewhat magical.

from node-cross-spawn.

satazor avatar satazor commented on May 14, 2024

del might be quite easy to cover: we'd spawn cmd.exe by default and only bypass it if the file extension is in the whitelist (basically .exe and .com, I think). However, that'll mean that we also spawn a shell for commands that don't specify the extension, which will be the vast majority of cross-platform code.

Alternatively, perhaps we should maintain a list of commands included in the output of cmd's help command?

cross-spawn resolves the command to a file using which. This means that even if you type git, it will resolve to {path}/git.exe on windows. I think that analysing the extension of the resolved file is the best option.

Another question is, should cross-spawn support del by default (i.e., without a proprietary option)? It's not spawning del, it's spawning cmd and running its del command, so the behavior is somewhat magical.

Removing the support for it would be a breaking change. cross-spawn supports it since the initial release and it's stated in the README.

from node-cross-spawn.

timdp avatar timdp commented on May 14, 2024

That's what semver is for. ;-)

from node-cross-spawn.

satazor avatar satazor commented on May 14, 2024

That's what semver is for. ;-)

I know but keeping it won't interfere with the solution we are agreeing with. When attempting to resolve del to a file, it will return null. Since we ONLY avoid cmd.exe for known extensions, del would still run through cmd.exe.

from node-cross-spawn.

timdp avatar timdp commented on May 14, 2024

I agree. Just wanted to point out that breaking changes wouldn't necessarily be an issue, and that conceptually, del isn't being spawned.

At any rate, I'll see if I can come up with a PR that adds the extension check. I'll probably also add an option to bypass it, so people have an override for executables that do need to run in a shell for whatever reason.

from node-cross-spawn.

satazor avatar satazor commented on May 14, 2024

sgtm

from node-cross-spawn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.