From a0e08e8c5b4e1a20a930324393a8309c17e1a283 Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Sat, 11 Jan 2025 20:58:03 +0100 Subject: [PATCH] Fix crash _fixes https://github.com/nikitabobko/AeroSpace/issues/671 --- Sources/AppBundle/command/impl/ExecAndForgetCommand.swift | 3 +-- Sources/Common/util/ResultEx.swift | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/AppBundle/command/impl/ExecAndForgetCommand.swift b/Sources/AppBundle/command/impl/ExecAndForgetCommand.swift index 7b2a076d..7a3de779 100644 --- a/Sources/AppBundle/command/impl/ExecAndForgetCommand.swift +++ b/Sources/AppBundle/command/impl/ExecAndForgetCommand.swift @@ -12,7 +12,6 @@ struct ExecAndForgetCommand: Command { process.environment = config.execConfig.envVariables process.executableURL = URL(filePath: "/bin/bash") process.arguments = ["-c", args.bashScript] - Result { try process.run() }.getOrThrow() - return true + return Result { try process.run() }.isSuccess } } diff --git a/Sources/Common/util/ResultEx.swift b/Sources/Common/util/ResultEx.swift index c608e272..929fb9c7 100644 --- a/Sources/Common/util/ResultEx.swift +++ b/Sources/Common/util/ResultEx.swift @@ -33,6 +33,13 @@ public extension Result { case .failure(let f): f } } + + var isSuccess: Bool { + switch self { + case .success: true + case .failure: false + } + } } public extension Result {