Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Conversation

@martinheidegger
Copy link

@martinheidegger martinheidegger commented Dec 6, 2015

This PR proposes a fix to an issue/bug in the osenv API.

Both the user and hostname methods can optionally fallback to the executables: whoami and hostname. If a fallback happens, that fallback will be async. In other words, depending on the environment user = osenv.user() may or may-not work as intended. osenv.user((err, user) => {} will always work as intended with the fallback. The important thing here is that the user will not notice the error.

To mitigate this, this PR uses a soft-breaking API. osenv.user() and osenv.hostname() will always return undefined. With a callback it will work, consistently.

An alternative solution to this would be to throw an error if no callback is given and/or write a deprecation warning.

@martinheidegger martinheidegger changed the title Used strict callbacks for user & hostname Required callbacks for user & hostname Feb 20, 2019
@martinheidegger
Copy link
Author

@iarna I updated the description to this PR. I hope it is more explanatory now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant