mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-07-19 07:58:38 +00:00
#13263 unintentionally prevents Forgejo from building on non-Linux UNIX OSes. This PR adds a second graceful shutdown implementation which uses repeated signalling of the subprocess to detect if it is still running. This additional implementation is used for non-Linux UNIX platforms. It is also a fallback when Linux returns `ENOSYS` which should be the case in Linux kernels older than 5.3. ## Testing - Validated build fails on a FreeBSD VM w/ head `forgejo` - `FreeBSD freebsd-test 15.1-RELEASE FreeBSD 15.1-RELEASE releng/15.1-n283562-96841ea08dcf GENERIC amd64` - Validate build succeeds and process tests pass on FreeBSD VM w/ this branch: ``` mfenniak@freebsd-test:~/Dev/forgejo $ GO_TEST_PACKAGES=forgejo.org/modules/process make test-backend Running go test with -tags 'sqlite sqlite_unlock_notify'... ok forgejo.org/modules/process 5.690s ``` - Note: other some other test modules do not pass like `forgejo.org/modules/log`, but this seems consistent with `forgejo` head. As we don't have a baseline for expectations here, this isn't an issue that can be addressed in this PR. - Fallback for pre-Linux 5.3 has been tested on a Debian Buster install, kernel 4.19.0, and confirmed `forgejo.org/modules/process` test success, and test failure without the fallback path. ### Tests for Go changes - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I ran... - [x] `make pr-go` before pushing ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. - [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change. - Adjustment to unreleased bugfix. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13289 Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
15 lines
339 B
Go
15 lines
339 B
Go
// Copyright 2026 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: GPLv3-or-later
|
|
|
|
// By default _unix is built on Linux as well, but we have a _linux specialization using pidfd.
|
|
//go:build !linux
|
|
|
|
package process
|
|
|
|
import (
|
|
"os/exec"
|
|
)
|
|
|
|
func platformSpecificGracefulCancel(cmd *exec.Cmd) func() error {
|
|
return nil
|
|
}
|