///|
/// Raised by `getcwd` when `@env.current_dir()` returns `None`. In
/// practice a process without a valid cwd cannot run, so this is
/// effectively unreachable — the suberror exists so callers can depend
/// on a `String` rather than `String?`.
pub suberror GetcwdFailed derive(Debug)
///|
/// Returns the server process's current working directory. Thin
/// wrapper around `@env.current_dir()`, which reads the kernel's cwd
/// via POSIX `getcwd(2)`. The wrapper exists so callers can depend on
/// a `String` rather than `String?`.
pub fn getcwd() -> String raise GetcwdFailed {
match @env.current_dir() {
Some(p) => p
None => raise GetcwdFailed
}
}