diff --git a/Sources/swcomp/BZip2Command.swift b/Sources/swcomp/BZip2Command.swift index c820a58d..60879cb3 100644 --- a/Sources/swcomp/BZip2Command.swift +++ b/Sources/swcomp/BZip2Command.swift @@ -33,11 +33,12 @@ class BZip2Command: Command { } else if inputURL.pathExtension == "bz2" { outputURL = inputURL.deletingPathExtension() } else { - fatalError(""" - Unable to get output path. - No output parameter was specified. - Extension was: \(inputURL.pathExtension) - """) + print(""" + ERROR: Unable to get output path. \ + No output parameter was specified. \ + Extension was: \(inputURL.pathExtension) + """) + exit(1) } let fileData = try Data(contentsOf: inputURL, options: .mappedIfSafe) @@ -57,7 +58,8 @@ class BZip2Command: Command { let compressedData = BZip2.compress(data: fileData) try compressedData.write(to: outputURL) } else { - fatalError("Neither compress nor decompress option in BZip2Command.") + print("ERROR: Neither compress nor decompress option in BZip2Command.") + exit(1) } } diff --git a/Sources/swcomp/GZipCommand.swift b/Sources/swcomp/GZipCommand.swift index 9b8c5595..10b7a9b8 100644 --- a/Sources/swcomp/GZipCommand.swift +++ b/Sources/swcomp/GZipCommand.swift @@ -33,11 +33,12 @@ class GZipCommand: Command { } else if inputURL.pathExtension == "gz" { outputURL = inputURL.deletingPathExtension() } else { - fatalError(""" - Unable to get output path. - No output parameter was specified. - Extension was: \(inputURL.pathExtension) - """) + print(""" + ERROR: Unable to get output path. \ + No output parameter was specified. \ + Extension was: \(inputURL.pathExtension) + """) + exit(1) } let fileData = try Data(contentsOf: inputURL, options: .mappedIfSafe) @@ -60,7 +61,8 @@ class GZipCommand: Command { writeHeaderCRC: true) try compressedData.write(to: outputURL) } else { - fatalError("Neither compress nor decompress option in GZipCommand.") + print("ERROR: Neither compress nor decompress option in GZipCommand.") + exit(1) } }