1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
// SPDX-License-Identifier: MPL-2.0
// (c) Hare authors <https://harelang.org>
use errors;
use fs;
use io;
// Represents a "null" file descriptor, e.g. /dev/null.
export type nullfd = void;
// Used to close a file descriptor which does not have the CLOEXEC flag set.
export type closefd = void;
export type command = struct {
platform: platform_cmd,
argv: platform_argv,
env: platform_env,
files: []((io::file | nullfd | closefd), io::file),
dir: str,
};
// Returned when path resolution fails to find a command by its name.
export type nocmd = !void;
// All errors that can be returned from os::exec.
export type error = !(nocmd | ...errors::error | io::error | fs::error);
// Returns a human-readable message for the given error.
export fn strerror(err: error) const str = {
match (err) {
case nocmd =>
return "Command not found";
case let err: errors::error =>
return errors::strerror(err);
case let err: io::error =>
return io::strerror(err);
case let err: fs::error =>
return fs::strerror(err);
};
};
|