spolu/warp

Detect shell using /etc/password before falling back to `bash`

Opened this issue · 4 comments

spolu commented
Detect shell using /etc/password before falling back to `bash`

I recommend a more common way:

  • getenv(SHELL)
  • getpwuid()->pw_shell
  • /bin/sh
spolu commented

@bAndie91 we do (1) and (3) indeed. We definitely want to implement (2). Do you know how portable is getpwuid()->pw_shell ?

spolu commented

Is that accessible from the command line given that this is all written in Go?

According to manual, getpwuid is conforming to SVr4, 4.3BSD, POSIX.1-2001.
Second question is a bit obscure to me. you can call getpwuid by getent passwd shell command, but I don't know anything about golang binding of libc function.