gitリポジトリのurlを貼り付けるだけでアプリケーションのビルドを実行するアプリ。 macOS用
Revisión | 9f7b703981acfa772bcd08e409d437665ccc2ab5 (tree) |
---|---|
Tiempo | 2018-04-07 00:46:47 |
Autor | masakih <masakih@user...> |
Commiter | masakih |
ProcessExtensionを使用するように変更
@@ -87,30 +87,26 @@ final class Git { | ||
87 | 87 | throw GitError.other("URL is invalid") |
88 | 88 | } |
89 | 89 | |
90 | - let git = Process() | |
91 | - git.launchPath = gitURL.path | |
92 | - git.arguments = args | |
90 | + let git = Process() <<< gitURL.path <<< args | |
93 | 91 | |
94 | 92 | git.currentDirectoryPath = workingURL.path |
95 | 93 | |
96 | - let pipe = Pipe() | |
97 | - git.standardError = pipe | |
98 | - | |
99 | - let logPipe = Pipe() | |
100 | - git.standardOutput = logPipe | |
101 | - git.standardError = logPipe | |
102 | - let log = LogStocker("git-" + args[0] + ".log") | |
103 | - log?.read(logPipe.fileHandleForReading) | |
94 | + let errorString = git >>> { (stdout, stderr) -> String in | |
95 | + | |
96 | + let log = LogStocker("git-" + args[0] + ".log") | |
97 | + log?.write(stdout.data) | |
98 | + | |
99 | + let errorString = stderr.string | |
100 | + errorString.map { log?.write($0) } | |
101 | + | |
102 | + return errorString ?? "" | |
103 | + } | |
104 | 104 | |
105 | - git.launch() | |
106 | 105 | git.waitUntilExit() |
107 | 106 | |
108 | 107 | guard git.terminationStatus == 0 else { |
109 | 108 | |
110 | - let data = pipe.fileHandleForReading.readDataToEndOfFile() | |
111 | - let string = String(data: data, encoding: .utf8) ?? "" | |
112 | - | |
113 | - throw GitError.gitError(git.terminationStatus, string) | |
109 | + throw GitError.gitError(git.terminationStatus, errorString) | |
114 | 110 | } |
115 | 111 | |
116 | 112 | } |