1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-13 14:07:20 +00:00
This commit is contained in:
techknowlogick
2021-02-28 18:08:33 -05:00
committed by GitHub
parent 030646eea4
commit 47f6a4ec3f
947 changed files with 26119 additions and 7062 deletions

View File

@ -96,6 +96,13 @@ func IsWindowsService() (bool, error) {
var psid uint32
err := windows.ProcessIdToSessionId(uint32(pbi[5]), &psid)
if err != nil {
if err == windows.ERROR_INVALID_PARAMETER {
// This error happens when Windows cannot find process parent.
// Perhaps process parent exited.
// Assume we are not running in a service, because service
// parent process (services.exe) cannot exit.
return false, nil
}
return false, err
}
if psid != 0 {