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

Allow passing a value to then of the main Listr instance #37

Closed
okonet opened this issue Nov 1, 2016 · 5 comments
Closed

Allow passing a value to then of the main Listr instance #37

okonet opened this issue Nov 1, 2016 · 5 comments

Comments

@okonet
Copy link
Contributor

okonet commented Nov 1, 2016

In the following example:

new Listr(tasks, { concurrent })
                    .run({
                        errors: []
                    })
                    .then((res) => {
                        console.log(res)
                    })
                    .catch((error) => {
                        console.error(error)
                        process.exit(1)
                    })

the res is always undefined even then I resolve internal tasks with some value.

Or alternatively add context to the then so it can be accessed.

@okonet
Copy link
Contributor Author

okonet commented Nov 1, 2016

The more I think about it, the less I see what should be passed to then as a value besides the context. In this case, I'd expect it also to be accessible in catch. But here is there the limitation of Promise will strike I think :(

@SamVerschueren
Copy link
Owner

You're right, the context should be returned as result. We could also easily attach it to the error object err.context.

@sndrs
Copy link

sndrs commented Nov 18, 2016

any chance you could publish a version with this @SamVerschueren? was following the readme and couldn't work out why i was getting undefined in run().then(console.log) 😄

@SamVerschueren
Copy link
Owner

Thanks for reminding me @sndrs ! I had hoped that I could resolve more issues in the meantime but I'm quite busy lately. Released in 0.8.0.

@sndrs
Copy link

sndrs commented Nov 20, 2016

thanks @SamVerschueren!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants