Skip to content

Commit 840e4d9

Browse files
committed
Write notes to stderr
1 parent 0c083c4 commit 840e4d9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Sources/Testing/ExitTests/SpawnProcess.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ 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-
print("!!FOUND posix_spawn_file_actions_addchdir")
60+
try! FileHandle.stderr.write("!!FOUND posix_spawn_file_actions_addchdir\n")
6161
return castCFunction(at: $0, to: (@convention(c) (UnsafeMutablePointer<P<posix_spawn_file_actions_t>>, UnsafePointer<CChar>) -> CInt).self)
6262
} ?? symbol(named: "posix_spawn_file_actions_addchdir_np").map {
63-
print("!!FOUND posix_spawn_file_actions_addchdir_np")
63+
try! FileHandle.stderr.write("!!FOUND posix_spawn_file_actions_addchdir_np\n")
6464
return castCFunction(at: $0, to: (@convention(c) (UnsafeMutablePointer<P<posix_spawn_file_actions_t>>, UnsafePointer<CChar>) -> CInt).self)
6565
} ?? {
66-
print("!!DID NOT FIND posix_spawn_file_actions_addchdir[_np]")
66+
try! FileHandle.stderr.write("!!DID NOT FIND posix_spawn_file_actions_addchdir[_np]\n")
6767
return nil
6868
}()
6969
#endif
@@ -163,11 +163,13 @@ func spawnExecutable(
163163
// posix_spawn(), so set it here in the parent process and hope
164164
// another thread does not stomp on the change (as Foundation does.)
165165
// Platforms known to take this path: Amazon Linux 2, OpenBSD, QNX
166-
print("!!CALLING chdir")
166+
try! FileHandle.stderr.write("!!CALLING chdir\n")
167167
guard 0 == chdir(currentDirectoryPath) else {
168168
throw CError(rawValue: swt_errno())
169169
}
170170
}
171+
172+
throw SystemError(description: "Early exiting to report on chdir.")
171173
}
172174

173175
// Forward standard I/O streams and any explicitly added file handles.

0 commit comments

Comments
 (0)