mirror of
https://github.com/apple/container.git
synced 2026-09-28 01:46:25 -04:00
cli: Add support for --stop-signal (#1462)
- Closes #1581. - This adds stop signal support to the cli. The priority is: 1. If an explicit stop signal is passed on the cli use this. 2. If not, check if there is a stop signal in the image config. 3. Finally, use the default (TERM).
This commit is contained in:
@@ -19,7 +19,6 @@ import ContainerAPIClient
|
||||
import ContainerResource
|
||||
import Containerization
|
||||
import ContainerizationError
|
||||
import ContainerizationOS
|
||||
import Foundation
|
||||
import Logging
|
||||
|
||||
@@ -35,7 +34,7 @@ extension Application {
|
||||
var all = false
|
||||
|
||||
@Option(name: .shortAndLong, help: "Signal to send to the containers")
|
||||
var signal: String = "SIGTERM"
|
||||
var signal: String?
|
||||
|
||||
@Option(name: .shortAndLong, help: "Seconds to wait before killing the containers")
|
||||
var time: Int32 = 5
|
||||
@@ -68,7 +67,7 @@ extension Application {
|
||||
|
||||
let opts = ContainerStopOptions(
|
||||
timeoutInSeconds: self.time,
|
||||
signal: try Signal(self.signal).rawValue
|
||||
signal: self.signal
|
||||
)
|
||||
try await Self.stopContainers(
|
||||
client: client,
|
||||
|
||||
Reference in New Issue
Block a user