-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Make it return something in Docker #21
Comments
Example how this has been addressed here: https://github.com/moleculerjs/moleculer/pull/396/files#diff-38423b3db1f1c2a43666c7ad898ba126R45 |
The |
It seems it is expected behaviour from Node and just not documented. I am not sure now should we catch and return empty object or return rejected promise and let consumers of this package deal with the problem. |
Thanks for opening the issue on Node.js. I have worked around the issue on my end now. |
This will not work in docker context we have here. Yes, it will not hard crash but it will not return single line result either. Now when
The |
Then I don't really know a way to get the username in Docker. I don't use Docker, but PR welcome if you can think of a way. |
Maybe something like this: https://stackoverflow.com/a/38927208/64949 |
I am not sure there is a way. There is no actual user in the container when I guess if we could detect the situation some how and just return I have some ideas, I’ll try them out. |
I opened a PR as possible solution. |
https://github.com/sindresorhus/username/blob/master/index.js#L29
Above userInfo() call should be wrapped in try catch block.
This causes crash when running for example in docker container like:
docker run --user $(id -u): $(id -g) ...
Because user in docker then will be without $HOME and username both.
The text was updated successfully, but these errors were encountered: