gitforge/modules/process
Mathieu Fenniak 787aea6fa2 fix: restore Forgejo's capability to build on non-Linux UNIX platforms (#13289)
#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>
2026-07-02 23:04:07 +02:00
..
context.go
error.go
graceful_cancel.go fix: restore Forgejo's capability to build on non-Linux UNIX platforms (#13289) 2026-07-02 23:04:07 +02:00
graceful_cancel_linux.go fix: restore Forgejo's capability to build on non-Linux UNIX platforms (#13289) 2026-07-02 23:04:07 +02:00
graceful_cancel_unix.go fix: restore Forgejo's capability to build on non-Linux UNIX platforms (#13289) 2026-07-02 23:04:07 +02:00
manager.go fix: restore Forgejo's capability to build on non-Linux UNIX platforms (#13289) 2026-07-02 23:04:07 +02:00
manager_exec.go
manager_stacktraces.go
manager_stacktraces_test.go
manager_test.go
manager_unix.go fix: restore Forgejo's capability to build on non-Linux UNIX platforms (#13289) 2026-07-02 23:04:07 +02:00
process.go