mirror of
https://github.com/apple/container.git
synced 2026-09-24 00:25:43 +00:00
fix: propagate error from createDirectory in system start (#1785)
- `SystemStart` used `try!` when creating the apiserver data directory. File system operations can fail for legitimate reasons: insufficient permissions, disk full, read-only volume. Crashing the process in these cases gives the user no actionable error message. - Replaced with `try` so the error propagates up and is surfaced cleanly.
This commit is contained in:
@@ -104,7 +104,7 @@ extension Application {
|
||||
|
||||
let apiServerDataPath = appRoot.appending(FilePath.Component("apiserver"))
|
||||
let apiServerDataURL = URL(fileURLWithPath: apiServerDataPath.string)
|
||||
try! FileManager.default.createDirectory(at: apiServerDataURL, withIntermediateDirectories: true)
|
||||
try FileManager.default.createDirectory(at: apiServerDataURL, withIntermediateDirectories: true)
|
||||
|
||||
var env = PluginLoader.filterEnvironment()
|
||||
env[ApplicationRoot.environmentName] = appRoot.string
|
||||
|
||||
Reference in New Issue
Block a user