Skip to content
Permalink
Browse files

command/install: don't warn about lack of root on Windows

On Windows, we don't have a good way to detect administrator-equivalent
permissions. The os.Geteuid call we use on Unix returns -1, so we always
print a warning to the user that they lack root permissions (which,
since it's Windows, which lacks the root user, technically they do).
Nevertheless, this warning is irksome and unwelcome since it's prone to
false positives and doesn't tell the user anything about whether their
operation is actually likely to succeed or fail. Simply skip printing it
on Windows or in any other case where we're unable to fetch the actual
user ID.
  • Loading branch information...
bk2204 committed Apr 23, 2019
1 parent 743f9b3 commit d245803fe744525757a4c1334f8671f3c613f18c
Showing with 4 additions and 1 deletion.
  1. +4 −1 commands/command_install.go
@@ -41,7 +41,10 @@ func cmdInstallOptions() *lfs.FilterOptions {
Exit("Only one of --local and --system options can be specified.")
}

if systemInstall && os.Geteuid() != 0 {
// This call will return -1 on Windows; don't warn about this there,
// since we can't detect it correctly.
uid := os.Geteuid()
if systemInstall && uid != 0 && uid != -1 {
Print("WARNING: current user is not root/admin, system install is likely to fail.")
}

0 comments on commit d245803

Please sign in to comment.
You can’t perform that action at this time.