File tree 1 file changed +15
-2
lines changed
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 {
104
104
arguments += buildParameters. xcbuildFlags
105
105
106
106
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)
109
114
} )
110
115
111
116
let process = Process ( arguments: arguments, outputRedirection: redirection)
@@ -119,6 +124,14 @@ public final class XcodeBuildSystem: SPMBuildCore.BuildSystem {
119
124
guard result. exitStatus == . terminated( code: 0 ) else {
120
125
throw Diagnostics . fatalError
121
126
}
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
+ }
122
135
}
123
136
124
137
func createBuildParametersFile( ) throws -> AbsolutePath ? {
You can’t perform that action at this time.
0 commit comments