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

Behaviour of util.promisify(childProcess.exec) inconsistent with node #13458

Closed
arantes555 opened this issue Jun 27, 2018 · 1 comment · Fixed by #13845
Closed

Behaviour of util.promisify(childProcess.exec) inconsistent with node #13458

arantes555 opened this issue Jun 27, 2018 · 1 comment · Fixed by #13845

Comments

@arantes555
Copy link

  • Electron Version: 1.8.7 & 2.0.3
  • Operating System (Platform and Version): MacOS 10.13.5
  • Last known working Electron version: None

Expected Behavior
util.promisify(childProcess.exec) should behave the same on electron as on node

Actual behavior
On node, promisify-ed versions of childProcess.exec & childProcess.execFile have custom behaviour, resolving to an object of the form {stdout, stderr}, or rejecting with an Error with the custom properties stdout & stderr. (Reference : https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)

On electron, there is no such behaviour, which leads to weird stuff.

To Reproduce

git clone https://github.com/arantes555/electron-bug-child_process.git -b master
cd electron-bug-child_process
npm install

# electron@1.8.7
npm run start-node # Note the objects `{ stdout: 'foobar\n', stderr: '' }` printed here
npm run start-electron # Note the simple `foobar`s printed here

# electron@2.0.3
git checkout electron2
npm install
npm run start-node
npm run start-electron # Note the same behaviour

Additional Information
The node behaviour is achieved thanks to https://nodejs.org/api/util.html#util_custom_promisified_functions . On node, childProcess.exec[util.promisify.custom] is defined, whereas it is undefined on electron.

It can also be noted that this issue has already been (poorly) reported some time ago #10925

@miniak
Copy link
Contributor

miniak commented Jul 29, 2018

@arantes555 ASAR support integration code is wrapping childProcess.exec, therefore childProcess.exec[util.promisify.custom] is being lost. I am fixing that in #13845

@codebytere codebytere removed this from Triage: Doesn't Block Stable in 3.0.x / 3.1.x Aug 6, 2018
@sofianguy sofianguy added this to Triage: Needs Review in 3.0.x / 3.1.x Aug 7, 2018
@codebytere codebytere removed this from Triage: Needs Review in 3.0.x / 3.1.x Aug 7, 2018
@sofianguy sofianguy added this to Fixed for next release in 3.0.x / 3.1.x Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
3.0.x / 3.1.x
Fixed (3.0.0-beta.5)
Development

Successfully merging a pull request may close this issue.

4 participants