Skip to content

Commit 0c083c4

Browse files
committed
Adding some temporary logging to see why Linux might be failing
1 parent 48b5eca commit 0c083c4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Sources/Testing/ExitTests/SpawnProcess.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,15 @@ private let _posix_spawn_file_actions_addclosefrom_np = symbol(named: "posix_spa
5757
/// consistently available across all platforms that implement the
5858
/// `posix_spawn()` API.
5959
private let _posix_spawn_file_actions_addchdir = symbol(named: "posix_spawn_file_actions_addchdir").map {
60-
castCFunction(at: $0, to: (@convention(c) (UnsafeMutablePointer<P<posix_spawn_file_actions_t>>, UnsafePointer<CChar>) -> CInt).self)
60+
print("!!FOUND posix_spawn_file_actions_addchdir")
61+
return castCFunction(at: $0, to: (@convention(c) (UnsafeMutablePointer<P<posix_spawn_file_actions_t>>, UnsafePointer<CChar>) -> CInt).self)
6162
} ?? symbol(named: "posix_spawn_file_actions_addchdir_np").map {
62-
castCFunction(at: $0, to: (@convention(c) (UnsafeMutablePointer<P<posix_spawn_file_actions_t>>, UnsafePointer<CChar>) -> CInt).self)
63-
}
63+
print("!!FOUND posix_spawn_file_actions_addchdir_np")
64+
return castCFunction(at: $0, to: (@convention(c) (UnsafeMutablePointer<P<posix_spawn_file_actions_t>>, UnsafePointer<CChar>) -> CInt).self)
65+
} ?? {
66+
print("!!DID NOT FIND posix_spawn_file_actions_addchdir[_np]")
67+
return nil
68+
}()
6469
#endif
6570
#endif
6671

@@ -158,6 +163,7 @@ func spawnExecutable(
158163
// posix_spawn(), so set it here in the parent process and hope
159164
// another thread does not stomp on the change (as Foundation does.)
160165
// Platforms known to take this path: Amazon Linux 2, OpenBSD, QNX
166+
print("!!CALLING chdir")
161167
guard 0 == chdir(currentDirectoryPath) else {
162168
throw CError(rawValue: swt_errno())
163169
}

0 commit comments

Comments
 (0)