mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-14 08:34:50 +00:00
26 lines
1.3 KiB
Diff
26 lines
1.3 KiB
Diff
diff --git a/Sources/Basic/Process.swift b/Sources/Basic/Process.swift
|
|
index f388c769..8f208691 100644
|
|
--- a/Sources/Basic/Process.swift
|
|
+++ b/Sources/Basic/Process.swift
|
|
@@ -322,7 +322,10 @@ public final class Process: ObjectIdentifierProtocol {
|
|
defer { posix_spawn_file_actions_destroy(&fileActions) }
|
|
|
|
// Workaround for https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=89e435f3559c53084498e9baad22172b64429362
|
|
- let devNull = strdup("/dev/null")
|
|
+ // Change allowing for newer version of glibc
|
|
+ guard let devNull = strdup("/dev/null") else {
|
|
+ throw SystemError.posix_spawn(0, arguments)
|
|
+ }
|
|
defer { free(devNull) }
|
|
// Open /dev/null as stdin.
|
|
posix_spawn_file_actions_addopen(&fileActions, 0, devNull, O_RDONLY, 0)
|
|
@@ -348,7 +351,7 @@ public final class Process: ObjectIdentifierProtocol {
|
|
|
|
let argv = CStringArray(arguments)
|
|
let env = CStringArray(environment.map({ "\($0.0)=\($0.1)" }))
|
|
- let rv = posix_spawnp(&processID, argv.cArray[0], &fileActions, &attributes, argv.cArray, env.cArray)
|
|
+ let rv = posix_spawnp(&processID, argv.cArray[0]!, &fileActions, &attributes, argv.cArray, env.cArray)
|
|
|
|
guard rv == 0 else {
|
|
throw SystemError.posix_spawn(rv, arguments)
|