Skip to content

Commit 17a34a0

Browse files
committed
Fix compilation on Windows… only if fileDescriptor were available on FileHandle on Windows
1 parent c4c585d commit 17a34a0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Sources/CLTLogger.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,19 @@ public struct CLTLogger : LogHandler {
201201
}
202202
var written: Int = 0
203203
repeat {
204+
#if !os(Windows)
204205
written += write(
205206
fh.fileDescriptor,
206207
bytes.baseAddress!.advanced(by: written),
207208
bytes.count - written
208209
)
210+
#else
211+
written += Int(write(
212+
fh.fileDescriptor,
213+
bytes.baseAddress!.advanced(by: written),
214+
UInt32(bytes.count - written)
215+
))
216+
#endif
209217
} while written < bytes.count && (errno == EINTR || errno == EAGAIN)
210218
}
211219
#endif
@@ -218,11 +226,19 @@ public struct CLTLogger : LogHandler {
218226
}
219227
var written: Int = 0
220228
repeat {
229+
#if !os(Windows)
221230
written += write(
222231
fh.fileDescriptor,
223232
bytes.baseAddress!.advanced(by: written),
224233
bytes.count - written
225234
)
235+
#else
236+
written += Int(write(
237+
fh.fileDescriptor,
238+
bytes.baseAddress!.advanced(by: written),
239+
UInt32(bytes.count - written)
240+
))
241+
#endif
226242
} while written < bytes.count && (errno == EINTR || errno == EAGAIN)
227243
}
228244
}

0 commit comments

Comments
 (0)