Skip to content

Conversation

@tunnckoCore
Copy link
Contributor

@tunnckoCore tunnckoCore commented Jun 6, 2018

fixes #6 - lib/runJavaScript.js is pretty cool, we should publish it to npm ;d I didn't found such thing, but i'm 99% that i seen such modules in the past year.

And actually, i don't see how we can implement #11, even if we not merge this PR.

Charlike Mike Reagent added 2 commits June 7, 2018 00:41
Signed-off-by: Charlike Mike Reagent <olsten.larck@gmail.com>
Signed-off-by: Charlike Mike Reagent <olsten.larck@gmail.com>
if (checkTypes(task, ['sh', 'bash'])) {
return runCLICommand({ task, resolve, reject })
runCLICommand({ task, resolve, reject })
return
Copy link
Owner

@egoist egoist Jun 7, 2018

Choose a reason for hiding this comment

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

why split the return statement?

Copy link
Contributor Author

@tunnckoCore tunnckoCore Jun 7, 2018

Choose a reason for hiding this comment

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

because it's more meaningful and it may be a bit confusing. we dont return promise from there anyway. and we dont need to return from there either because we are passing resolve and reject to the runCLICommand.

Copy link
Contributor Author

@tunnckoCore tunnckoCore Jun 7, 2018

Choose a reason for hiding this comment

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

also, return frome promise constructor make no sense, you are forced to use resolve and reject anyway. only if something fail in that constructor only then it goes to the catch handler, otherwise you are forced to use resolve and reject

in this case it will just throw , because we directly await the promise

@tunnckoCore
Copy link
Contributor Author

tunnckoCore commented Oct 10, 2018

I always thought that it's always a good practice to separate the return inside callbacks and always did that in the old days of callbacks. It just not make any sense. The promise constructor is a callback.

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

Successfully merging this pull request may close these issues.

Running the Node tasks in a separate subprocess or sandbox

2 participants