question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

promisify a function has More than two params

See original GitHub issue

v1.11

promisify a function that callback function has More than two params

e.q.

const { exec } = require('child_process');
const exec_1 =  require('util').promisify(exec);
const exec_2 = require('aigle').promisify(exec);

const cmd = 'ls 1>&2';
exec_1(cmd).then(raw=> console.log('exec 1=>',raw)).catch(e=>console.log('exec 1 error=>',e));
exec_2(cmd).then(raw=> console.log('exec 2=>',raw)).catch(e=>console.log('exec 2 error=>',e));

.result

exec 1 => { stdout: '',  stderr: 'a.file'}
exec 2 => 

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
suguru03commented, May 7, 2018

I published it on v1.12.0!

1reaction
suguru03commented, Apr 26, 2018

@HoKangInfo @thammin Thanks for the issue, it is so helpful! Yes, let’s support it! 😄

we need to implement this in Node.js environment only and just skip the checks in browser.

Sure, we need to handle it. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

NodeJs: util.promisify where the callback function has multiple ...
It turns multiple arguments of callback into an array. So, in my case for MySQL's query that the default callback has 3 arguments...
Read more >
`promisify()` behavior with multiple parameters can break ...
Current behavior of promisify is to resolve to an array when there is more than one result to the callback. Unfortunately, if a...
Read more >
Promisification - The Modern JavaScript Tutorial
Here, promisify assumes that the original function expects a callback with exactly two arguments (err, result) . That's what we encounter ...
Read more >
Passing multiple arguments in promises - Gleb Bahmutov
We are using Q.all method to execute multiple promises in parallel and get a single promise back that resolves with an array. The...
Read more >
How to pass multiple arguments to Promise.resolve - JavaScript
I am trying to learn JS Promise. I have the following function which returns either the sum or difference of two numbers depending...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found