Skip to content

Test fixes and intermittent Linux failures #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could elaborate more on what this file does? I don't think 6.1.0 is an appropriate version because we need 6.2 for Span and the majority of the package depends on that trait (i.e. would require 6.2).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file marks what the standard swift toolchain version for this project should be for development, and testing. So, if I were developing with this package, what toolchain should I use to swift build and swift test and expect it to work.

If a developer has swiftly installed then swiftly will use it automatically. If CI supports it then that will be the toolchain that it uses as well. This has no effect on downstream packages.

https://www.swift.org/swiftly/documentation/swiftly/use-toolchains#Sharing-recommended-toolchain-versions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If 6.2 of Swift is required to develop/test subprocess, then the swift version file could have a particular main-snapshot-xxxx-yy-zz that's known to be good at a point in time, possibly tested by CI.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh thanks. In that case let's leave it at 6.1.0 until we officially releases 6.2.

2 changes: 1 addition & 1 deletion Sources/Subprocess/Platforms/Subprocess+Linux.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 7 additions & 0 deletions Sources/Subprocess/Platforms/Subprocess+Unix.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Tests/SubprocessTests/SubprocessTests+Darwin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Tests/SubprocessTests/SubprocessTests+Linux.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions Tests/SubprocessTests/SubprocessTests+Unix.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -795,7 +795,7 @@ extension SubprocessUnixTests {
return
}
let result = try await Subprocess.run(
.name("/bin/bash"),
.path("/bin/bash"),
arguments: [
"-c",
"""
Expand Down Expand Up @@ -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
Expand Down
Loading