From 7f4c079fedee8c7163c2470f2d3b6894ec61a006 Mon Sep 17 00:00:00 2001
From: Chris McGee <christie_mcgee@apple.com>
Date: Thu, 24 Apr 2025 13:49:14 -0400
Subject: [PATCH 1/5] Fix Linux compile error and one failing test

---
 .swift-version                                   | 1 +
 Sources/Subprocess/Configuration.swift           | 4 ++++
 Tests/SubprocessTests/SubprocessTests+Unix.swift | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
 create mode 100644 .swift-version

diff --git a/.swift-version b/.swift-version
new file mode 100644
index 0000000..042718e
--- /dev/null
+++ b/.swift-version
@@ -0,0 +1 @@
+main-snapshot-2025-04-12
\ No newline at end of file
diff --git a/Sources/Subprocess/Configuration.swift b/Sources/Subprocess/Configuration.swift
index f6189c6..656a0fb 100644
--- a/Sources/Subprocess/Configuration.swift
+++ b/Sources/Subprocess/Configuration.swift
@@ -871,7 +871,11 @@ internal struct CreatedPipe {
     }
 
     internal init(closeWhenDone: Bool) throws {
+#if os(Windows)
         let pipe = try FileDescriptor.ssp_pipe()
+#else
+        let pipe = try FileDescriptor.pipe()
+#endif
 
         self.readFileDescriptor = .init(
             pipe.readEnd,
diff --git a/Tests/SubprocessTests/SubprocessTests+Unix.swift b/Tests/SubprocessTests/SubprocessTests+Unix.swift
index 4833d93..56a56fc 100644
--- a/Tests/SubprocessTests/SubprocessTests+Unix.swift
+++ b/Tests/SubprocessTests/SubprocessTests+Unix.swift
@@ -729,7 +729,7 @@ extension SubprocessUnixTests {
         var platformOptions = PlatformOptions()
         platformOptions.supplementaryGroups = Array(expectedGroups)
         let idResult = try await Subprocess.run(
-            .name("/usr/bin/swift"),
+            .name("swift"),
             arguments: [getgroupsSwift.string],
             platformOptions: platformOptions,
             output: .string

From babff74caafd144b6cc3746e8044da8d0d553f8d Mon Sep 17 00:00:00 2001
From: Chris McGee <christie_mcgee@apple.com>
Date: Thu, 24 Apr 2025 14:21:57 -0400
Subject: [PATCH 2/5] Merge with #23 and update recommended swift version

---
 .swift-version                                     | 2 +-
 Sources/Subprocess/Configuration.swift             | 4 ----
 Sources/Subprocess/Platforms/Subprocess+Unix.swift | 7 +++++++
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/.swift-version b/.swift-version
index 042718e..358e78e 100644
--- a/.swift-version
+++ b/.swift-version
@@ -1 +1 @@
-main-snapshot-2025-04-12
\ No newline at end of file
+6.1.0
\ No newline at end of file
diff --git a/Sources/Subprocess/Configuration.swift b/Sources/Subprocess/Configuration.swift
index 656a0fb..f6189c6 100644
--- a/Sources/Subprocess/Configuration.swift
+++ b/Sources/Subprocess/Configuration.swift
@@ -871,11 +871,7 @@ internal struct CreatedPipe {
     }
 
     internal init(closeWhenDone: Bool) throws {
-#if os(Windows)
         let pipe = try FileDescriptor.ssp_pipe()
-#else
-        let pipe = try FileDescriptor.pipe()
-#endif
 
         self.readFileDescriptor = .init(
             pipe.readEnd,
diff --git a/Sources/Subprocess/Platforms/Subprocess+Unix.swift b/Sources/Subprocess/Platforms/Subprocess+Unix.swift
index b361955..edbabb5 100644
--- a/Sources/Subprocess/Platforms/Subprocess+Unix.swift
+++ b/Sources/Subprocess/Platforms/Subprocess+Unix.swift
@@ -375,6 +375,13 @@ extension Configuration {
 
 // MARK: - FileDescriptor extensions
 extension FileDescriptor {
+    internal static func ssp_pipe() throws -> (
+        readEnd: FileDescriptor,
+        writeEnd: FileDescriptor
+    ) {
+        try pipe()
+    }
+
     internal static func openDevNull(
         withAcessMode mode: FileDescriptor.AccessMode
     ) throws -> FileDescriptor {

From 76ca1326677a7f73ec0706bd0172645c671aff64 Mon Sep 17 00:00:00 2001
From: Chris McGee <christie_mcgee@apple.com>
Date: Thu, 24 Apr 2025 15:42:16 -0400
Subject: [PATCH 3/5] Use path variant for executables with full paths in tests

---
 Tests/SubprocessTests/SubprocessTests+Darwin.swift |  2 +-
 Tests/SubprocessTests/SubprocessTests+Linux.swift  |  2 +-
 Tests/SubprocessTests/SubprocessTests+Unix.swift   | 10 +++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Tests/SubprocessTests/SubprocessTests+Darwin.swift b/Tests/SubprocessTests/SubprocessTests+Darwin.swift
index 3f88a35..f1a3874 100644
--- a/Tests/SubprocessTests/SubprocessTests+Darwin.swift
+++ b/Tests/SubprocessTests/SubprocessTests+Darwin.swift
@@ -41,7 +41,7 @@ struct SubprocessDarwinTests {
         // Check the proces ID (pid), pross group ID (pgid), and
         // controling terminal's process group ID (tpgid)
         let psResult = try await Subprocess.run(
-            .name("/bin/bash"),
+            .path("/bin/bash"),
             arguments: ["-c", "ps -o pid,pgid,tpgid -p $$"],
             platformOptions: platformOptions,
             output: .string
diff --git a/Tests/SubprocessTests/SubprocessTests+Linux.swift b/Tests/SubprocessTests/SubprocessTests+Linux.swift
index 83b3375..b5ea036 100644
--- a/Tests/SubprocessTests/SubprocessTests+Linux.swift
+++ b/Tests/SubprocessTests/SubprocessTests+Linux.swift
@@ -33,7 +33,7 @@ struct SubprocessLinuxTests {
             setgid(4321)
         }
         let idResult = try await Subprocess.run(
-            .name("/usr/bin/id"),
+            .path("/usr/bin/id"),
             arguments: ["-g"],
             platformOptions: platformOptions,
             output: .string
diff --git a/Tests/SubprocessTests/SubprocessTests+Unix.swift b/Tests/SubprocessTests/SubprocessTests+Unix.swift
index 56a56fc..2742b4f 100644
--- a/Tests/SubprocessTests/SubprocessTests+Unix.swift
+++ b/Tests/SubprocessTests/SubprocessTests+Unix.swift
@@ -658,7 +658,7 @@ extension SubprocessUnixTests {
             contentsOf: URL(filePath: theMysteriousIsland.string)
         )
         let catResult = try await Subprocess.run(
-            .name("/bin/bash"),
+            .path("/bin/bash"),
             arguments: ["-c", "cat \(theMysteriousIsland.string) 1>&2"],
             error: .data(limit: 2048 * 1024)
         )
@@ -756,7 +756,7 @@ extension SubprocessUnixTests {
         // Sets the process group ID to 0, which creates a new session
         platformOptions.processGroupID = 0
         let psResult = try await Subprocess.run(
-            .name("/bin/bash"),
+            .path("/bin/bash"),
             arguments: ["-c", "ps -o pid,pgid -p $$"],
             platformOptions: platformOptions,
             output: .string
@@ -782,7 +782,7 @@ extension SubprocessUnixTests {
         // Check the proces ID (pid), pross group ID (pgid), and
         // controling terminal's process group ID (tpgid)
         let psResult = try await Subprocess.run(
-            .name("/bin/bash"),
+            .path("/bin/bash"),
             arguments: ["-c", "ps -o pid,pgid,tpgid -p $$"],
             platformOptions: platformOptions,
             output: .string
@@ -795,7 +795,7 @@ extension SubprocessUnixTests {
             return
         }
         let result = try await Subprocess.run(
-            .name("/bin/bash"),
+            .path("/bin/bash"),
             arguments: [
                 "-c",
                 """
@@ -916,7 +916,7 @@ extension SubprocessUnixTests {
         isEqualTo expected: gid_t
     ) async throws {
         let idResult = try await Subprocess.run(
-            .name("/usr/bin/id"),
+            .path("/usr/bin/id"),
             arguments: [argument],
             platformOptions: platformOptions,
             output: .string

From ed85e10c487f92a7f619df22a11dd2a237cb8f01 Mon Sep 17 00:00:00 2001
From: Chris McGee <christie_mcgee@apple.com>
Date: Thu, 24 Apr 2025 16:04:08 -0400
Subject: [PATCH 4/5] Add additional check on EACCES on Linux when considering
 possible paths

EACCES can be something that comes back from execve() for reasons
related to permissions, or file type. Instead of failing due to the
underlying error, just continue to the next possible path.
---
 Sources/Subprocess/Platforms/Subprocess+Linux.swift | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Sources/Subprocess/Platforms/Subprocess+Linux.swift b/Sources/Subprocess/Platforms/Subprocess+Linux.swift
index f77512d..6cab918 100644
--- a/Sources/Subprocess/Platforms/Subprocess+Linux.swift
+++ b/Sources/Subprocess/Platforms/Subprocess+Linux.swift
@@ -107,7 +107,7 @@ extension Configuration {
                 }
                 // Spawn error
                 if spawnError != 0 {
-                    if spawnError == ENOENT {
+                    if spawnError == ENOENT || spawnError == EACCES {
                         // Move on to another possible path
                         continue
                     }

From 53e55edb13f51ebba86fb9362733ed706386c084 Mon Sep 17 00:00:00 2001
From: Chris McGee <87777443+cmcgee1024@users.noreply.github.com>
Date: Wed, 14 May 2025 09:55:55 -0400
Subject: [PATCH 5/5] Update .licenseignore

---
 .licenseignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.licenseignore b/.licenseignore
index c9b1be8..1ade952 100644
--- a/.licenseignore
+++ b/.licenseignore
@@ -1,3 +1,4 @@
 Package.swift
 Package@swift-6.0.swift
 LICENSE
+.swift-version