Skip to content

Commit

Permalink
MuxFile: better exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
kojirou1994 committed Nov 16, 2023
1 parent 03496dc commit 86b7f3e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/choco-cli/Commands/MuxFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ struct MuxFile: ParsableCommand {
let fileRemuxOptions = FileRemuxOptions(recursive: recursive, copyNormalFiles: copyNormalFiles, copyOverwrite: copyOverwrite, removeSourceFiles: removeSourceFiles, fileTypes: FileRemuxOptions.defaultFileTypes)

var endlessLoopCount = 0
var hasFailureTasks = false

while true {
hasFailureTasks = false

let results = inputs.map { input in
muxer.mux(file: URL(fileURLWithPath: input), options: fileRemuxOptions)
Expand Down Expand Up @@ -63,6 +65,7 @@ struct MuxFile: ParsableCommand {
print("success ==>")
print("\(output.path.path) \(ByteCountFormatter.string(fromByteCount: numericCast(output.size), countStyle: .file))")
case .failure(let error):
hasFailureTasks = true
print("failure: \(error)")
}
print()
Expand All @@ -81,6 +84,10 @@ struct MuxFile: ParsableCommand {
}

} // loop end

if hasFailureTasks {
throw ExitCode(1)
}
}

}
Expand Down

0 comments on commit 86b7f3e

Please sign in to comment.