Functions
fn args() ArgIterator
Holds the command-line arguments, with the program name as the first entry. Use…
Holds the command-line arguments, with the program name as the first entry. Use argsWithAllocator() for cross-platform code.
fn argsWithAllocator(allocator: Allocator) ArgIterator.InitError!ArgIterator
You must deinitialize iterator’s internal buffers by calling
deinit
when done.fn cleanExit() void
Indicate that we are now terminating with a successful exit code. In debug buil…
Indicate that we are now terminating with a successful exit code. In debug builds, this is a no-op, so that the calling code’s cleanup mechanisms are tested and so that external tools that check for resource leaks can be accurate. In release builds, this calls exit(0), and does not return.
fn execv(allocator: Allocator, argv: []const []const u8) ExecvError
Replaces the current process image with the executed process. This function mus…
Replaces the current process image with the executed process. This function must allocate memory to add a null terminating bytes on path and each arg. It must also convert to KEY=VALUE\0 format for environment variables, and include null pointers after the args and after the environment variables.
argv[0]
is the executable path. This function also uses the PATH environment variable to get the full path to the executable. Due to the heap-allocation, it is illegal to call this function in a fork() child. For that use case, use thestd.os
functions directly.fn execve(allocator: Allocator, argv: []const []const u8, env_map: ?*const EnvMap) ExecvError
Replaces the current process image with the executed process. This function mus…
Replaces the current process image with the executed process. This function must allocate memory to add a null terminating bytes on path and each arg. It must also convert to KEY=VALUE\0 format for environment variables, and include null pointers after the args and after the environment variables.
argv[0]
is the executable path. This function also uses the PATH environment variable to get the full path to the executable. Due to the heap-allocation, it is illegal to call this function in a fork() child. For that use case, use thestd.os
functions directly.fn getEnvMap(allocator: Allocator) !EnvMap
Returns a snapshot of the environment variables of the current process. Any mod…
Returns a snapshot of the environment variables of the current process. Any modifications to the resulting EnvMap will not be not reflected in the environment, and likewise, any future modifications to the environment will not be reflected in the EnvMap. Caller owns resulting
EnvMap
and should call itsdeinit
fn when done.fn getEnvVarOwned(allocator: Allocator, key: []const u8) GetEnvVarOwnedError![]u8
Caller must free returned memory.
fn hasEnvVar(allocator: Allocator, key: []const u8) error{OutOfMemory}!bool
No documentation provided.
fn posixGetUserInfo(name: []const u8) !UserInfo
TODO this reads /etc/passwd. But sometimes the user/id mapping is in something e…
TODO this reads /etc/passwd. But sometimes the user/id mapping is in something else like NIS, AD, etc. See
man nss
or look at an strace forid myuser
.
Values
ExecvError | type | |
can_execv | type | Tells whether calling the |
can_spawn | type | Tells whether spawning child processes is supported (e.g. via ChildProcess) |
changeCurDirC | undefined |