File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -104,8 +104,13 @@ public final class XcodeBuildSystem: SPMBuildCore.BuildSystem {
104104 arguments += buildParameters. xcbuildFlags
105105
106106 let delegate = createBuildDelegate ( )
107- let redirection : Process . OutputRedirection = . stream( stdout: delegate. parse ( bytes: ) , stderr: { bytes in
108- self . diagnostics. emit ( StringError ( String ( bytes: bytes, encoding: . utf8) !) )
107+ var hasStdout = false
108+ var stderrBuffer : [ UInt8 ] = [ ]
109+ let redirection : Process . OutputRedirection = . stream( stdout: { bytes in
110+ hasStdout = hasStdout || !bytes. isEmpty
111+ delegate. parse ( bytes: bytes)
112+ } , stderr: { bytes in
113+ stderrBuffer. append ( contentsOf: bytes)
109114 } )
110115
111116 let process = Process ( arguments: arguments, outputRedirection: redirection)
@@ -119,6 +124,14 @@ public final class XcodeBuildSystem: SPMBuildCore.BuildSystem {
119124 guard result. exitStatus == . terminated( code: 0 ) else {
120125 throw Diagnostics . fatalError
121126 }
127+
128+ if !hasStdout {
129+ if !stderrBuffer. isEmpty {
130+ diagnostics. emit ( StringError ( String ( decoding: stderrBuffer, as: UTF8 . self) ) )
131+ } else {
132+ diagnostics. emit ( StringError ( " Unknown error: stdout and stderr are empty " ) )
133+ }
134+ }
122135 }
123136
124137 func createBuildParametersFile( ) throws -> AbsolutePath ? {
You can’t perform that action at this time.
0 commit comments