Skip to content

Commit 94b8d46

Browse files
authored
Subprocess: avoid some strdup deprecation warnings on Windows (#121)
Use the POSIX compliant `_strdup` on Windows instead of `strdup` to avoid some warnings when building.
1 parent 41ce3df commit 94b8d46

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/Subprocess/Configuration.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,17 @@ internal enum StringOrRawBytes: Sendable, Hashable {
533533
func createRawBytes() -> UnsafeMutablePointer<CChar> {
534534
switch self {
535535
case .string(let string):
536+
#if os(Windows)
537+
return _strdup(string)
538+
#else
536539
return strdup(string)
540+
#endif
537541
case .rawBytes(let rawBytes):
542+
#if os(Windows)
543+
return _strdup(rawBytes)
544+
#else
538545
return strdup(rawBytes)
546+
#endif
539547
}
540548
}
541549

0 commit comments

Comments
 (0)