mirror of
https://github.com/kemko/nomad.git
synced 2026-01-02 00:15:43 +03:00
On Windows, the `os.Process.Signal` method returns an error when sending `os.Interrupt` (SIGINT) because it isn't implemented. This causes test servers in the `testutil` packages to break on Windows. Use the platform specific syscalls to generate the SIGINT instead. The agent's signal handler also did not correctly handle the Ctrl-C because we were masking os.Interrupt instead of SIGINT. Fixes: https://github.com/hashicorp/nomad/issues/26775 Co-authored-by: Chris Roberts <croberts@hashicorp.com>
18 lines
338 B
Go
18 lines
338 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
//go:build !windows
|
|
|
|
package testutil
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
// gracefulStop performs a platform-specific graceful stop. On non-Windows this
|
|
// uses the Go API for SIGINT
|
|
func (s *TestServer) gracefulStop() error {
|
|
err := s.cmd.Process.Signal(os.Interrupt)
|
|
return err
|
|
}
|