Origen-SDK / o2

MIT License
4 stars 0 forks source link

Fix user ID fetch for Linux #112

Closed ginty closed 4 years ago

ginty commented 4 years ago

When releasing an initial version of the proj command it failed miserably because the function to determine the user ID didn't work. It did work in a debug build, but not in a release build. The root cause is inside a whoami crate that I used and which seems to use some clib internally - i.e. not easy to debug and I would like to get rid of it.

This update transitions to a less magic approach of simply running 'whoami' and capturing the output, and it now works for the production release Linux build.

@pderouen, any chance you could look at the Windows branch of this? Is there a similar command we could run in Windows space?

Note that one thing I discovered here is that if cfg!(linux) does not work, it has to be either if cfg!(unix) or if cfg!(target_os="linux").

pderouen commented 4 years ago

I'm all for dropping dependencies where possible. On windows the easiest way to get the current user is to read the environment variable "USERNAME".

Is there a command line I can run to have origen tell me what it thinks my user name is?

ginty commented 4 years ago

Hi @pderouen, no command way to view it right now, quickest way would probably be just to make a quick test to do it. The code to invoke is origen::USER.id().

ginty commented 4 years ago

@pderouen, are you planning to push an update for the Windows path here, or will we just go ahead and merge this?

pderouen commented 4 years ago

This branch works as is from Windows