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

Reliance on cmd.exe #16

Open
TotalGriffLock opened this issue Mar 11, 2022 · 4 comments
Open

Reliance on cmd.exe #16

TotalGriffLock opened this issue Mar 11, 2022 · 4 comments

Comments

@TotalGriffLock
Copy link
Contributor

We use a package in our corporate environment which imports your wmic module to execute the wmic command. However in our environment normal users (i.e. non admins) do not have access to the command prompt - it's disabled by policy. This breaks the wmic module as you use child_process.spawn to start wmic.exe in a full shell (cmd /c) rather than using child_process.execfile which would run the exe directly. Is this intentional due to the amount of output data the wmic command can generate? Or does the wmic.exe process require a full cmd shell in order to work properly?

@tomas
Copy link
Owner

tomas commented Mar 11, 2022

Not sure-- it's been a long time since I looked at that part of the code.

Happy to accept a PR that modifies the behaviour in order to make it work without cmd.exe!

@TotalGriffLock
Copy link
Contributor Author

Done!

@tomas
Copy link
Owner

tomas commented Mar 11, 2022

That was fast!

@gaofeng
Copy link

gaofeng commented Oct 29, 2022

This change will get a warning message below and can't show correct Chinese characters:

Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding

child_process.execFile has an option of 'encoding', so I think we can change the variable opts to { env: process.env, cwd: process.env.TEMP ,encoding: consoleEncoding} at line 159.

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

No branches or pull requests

3 participants