Skip to content

Commit 8a539e8

Browse files
committed
Include the path in the a chdir error message.
1 parent c9bdf38 commit 8a539e8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/POSIX/Error.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
public enum SystemError: Swift.Error {
12-
case chdir(Int32)
12+
case chdir(Int32, String)
1313
case close(Int32)
1414
case dirfd(Int32, String)
1515
case fgetc(Int32)
@@ -45,8 +45,8 @@ extension SystemError: CustomStringConvertible {
4545
}
4646

4747
switch self {
48-
case .chdir(let errno):
49-
return "chdir error: \(strerror(errno))"
48+
case .chdir(let errno, let path):
49+
return "chdir error: \(strerror(errno)): \(path)"
5050
case .close(let errno):
5151
return "close error: \(strerror(errno))"
5252
case .dirfd(let errno, _):

Sources/POSIX/chdir.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public func chdir(_ path: String) throws {
2222
}
2323

2424
guard libc.chdir(path) == 0 else {
25-
throw SystemError.chdir(errno)
25+
throw SystemError.chdir(errno, path)
2626
}
2727
}
2828

0 commit comments

Comments
 (0)