nextcloud-desktop/admin/osx/mac-crafter/Sources/State.swift
Iva Horn e93e23f0a7 feat(mac-crafter): Update to Swift 6.1 and Strict Concurrency Checks.
- Isolated global state into an actor.
- Updated declarations and calls to reflect asynchronicity.
- The replacement of the enumerator with subpathsOfDirectory(atPath:) was suggested by Copilot to necessarily avoid the use of synchronous enumeration in an asynchronous context.
- Updated README.

Signed-off-by: Iva Horn <iva.horn@icloud.com>
2025-07-16 11:56:55 +02:00

31 lines
614 B
Swift

// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2025 Iva Horn
// SPDX-License-Identifier: GPL-2.0-or-later
import Foundation
///
/// Global state object.
///
actor State {
weak private var process: Process?
static let shared = State()
///
/// Register the shell command process.
///
func register(_ process: Process) {
self.process = process
}
///
/// Terminate any previously registered shell command process.
///
/// Silently fails in case no process is registered.
///
func terminate() {
process?.terminate()
}
}