Module
Module documentation.
moduleos.process
Classes
Classes and inheritance.
classos.process::Pipe
@brief`Pipe` type.
@details`Pipe` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class Pipe {
/*
@brief `read_fd` field.Functions
Free functions and class methods.
functionos.process::__argv_get
Signature
extern func __argv_get(argc: Int, argv: Int, idx: Int) -> String;extern func __argv_get(argc: Int, argv: Int, idx: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__spawn_shell`.@briefBinds the low-level runtime symbol `__argv_get`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- argcNumber of command-line or native arguments available in `argv`.
- argvNative pointer or vector containing command-line argument values.
- idxZero-based index.
@returnReturns the operation result as `String`.
functionos.process::__spawn_shell
Signature
extern func __spawn_shell(cmd: String) -> Int;extern func __spawn_shell(cmd: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__exec_capture`.@briefBinds the low-level runtime symbol `__spawn_shell`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- cmdCommand string or command code sent to a process, protocol, or runtime binding.
@returnReturns the operation result as `Int`.
functionos.process::__exec_capture
Signature
extern func __exec_capture(cmd: String) -> String;extern func __exec_capture(cmd: String) -> String;
/*
@brief Binds the low-level runtime symbol `__os_exit`.@briefBinds the low-level runtime symbol `__exec_capture`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- cmdCommand string or command code sent to a process, protocol, or runtime binding.
@returnReturns the operation result as `String`.
functionos.process::__os_exit
Signature
extern func __os_exit(code: Int) -> Void;extern func __os_exit(code: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__process_getpid`.@briefBinds the low-level runtime symbol `__os_exit`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- codeNumeric status, error, signal, opcode, or platform code handled by this API.
@returnVoid
functionos.process::__process_getpid
Signature
extern func __process_getpid() -> Int;extern func __process_getpid() -> Int;
/*
@brief Binds the low-level runtime symbol `__process_getppid`.@briefBinds the low-level runtime symbol `__process_getpid`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionos.process::__process_getppid
Signature
extern func __process_getppid() -> Int;extern func __process_getppid() -> Int;
/*
@brief Binds the low-level runtime symbol `__process_fork`.@briefBinds the low-level runtime symbol `__process_getppid`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionos.process::__process_fork
Signature
extern func __process_fork() -> Int;extern func __process_fork() -> Int;
/*
@brief Binds the low-level runtime symbol `__process_clone`.@briefBinds the low-level runtime symbol `__process_fork`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionos.process::__process_clone
Signature
extern func __process_clone(flags: Int) -> Int;extern func __process_clone(flags: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__process_wait_pid`.@briefBinds the low-level runtime symbol `__process_clone`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- flagsBitmask of option flags that controls how the operation is performed.
@returnReturns the operation result as `Int`.
functionos.process::__process_wait_pid
Signature
extern func __process_wait_pid(pid: Int) -> Int;extern func __process_wait_pid(pid: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__process_pipe`.@briefBinds the low-level runtime symbol `__process_wait_pid`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- pidOperating-system process identifier targeted by the operation.
@returnReturns the operation result as `Int`.
functionos.process::__process_pipe
Signature
extern func __process_pipe() -> Int;extern func __process_pipe() -> Int;
/*
@brief Binds the low-level runtime symbol `__posix_fd_pair_left`.@briefBinds the low-level runtime symbol `__process_pipe`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionos.process::__posix_fd_pair_left
Signature
extern func __posix_fd_pair_left(handle: Int) -> Int;extern func __posix_fd_pair_left(handle: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__posix_fd_pair_right`.@briefBinds the low-level runtime symbol `__posix_fd_pair_left`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- handleUnderlying runtime handle.
@returnReturns the operation result as `Int`.
functionos.process::__posix_fd_pair_right
Signature
extern func __posix_fd_pair_right(handle: Int) -> Int;extern func __posix_fd_pair_right(handle: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__posix_fd_pair_free`.@briefBinds the low-level runtime symbol `__posix_fd_pair_right`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- handleUnderlying runtime handle.
@returnReturns the operation result as `Int`.
functionos.process::__posix_fd_pair_free
Signature
extern func __posix_fd_pair_free(handle: Int) -> Void;extern func __posix_fd_pair_free(handle: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__posix_read_fd`.@briefBinds the low-level runtime symbol `__posix_fd_pair_free`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- handleUnderlying runtime handle.
@returnVoid
functionos.process::__posix_read_fd
Signature
extern func __posix_read_fd(fd: Int, max_bytes: Int) -> String;extern func __posix_read_fd(fd: Int, max_bytes: Int) -> String;
/*
@brief Binds the low-level runtime symbol `__posix_write_fd`.@briefBinds the low-level runtime symbol `__posix_read_fd`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns the operation result as `String`.
functionos.process::__posix_write_fd
Signature
extern func __posix_write_fd(fd: Int, data: String) -> Int;extern func __posix_write_fd(fd: Int, data: String) -> Int;
/*
@brief Binds the low-level runtime symbol `__posix_close_fd`.@briefBinds the low-level runtime symbol `__posix_write_fd`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
- dataInput or output data buffer.
@returnReturns the operation result as `Int`.
functionos.process::__posix_close_fd
Signature
extern func __posix_close_fd(fd: Int) -> Int;extern func __posix_close_fd(fd: Int) -> Int;
/*@briefBinds the low-level runtime symbol `__posix_close_fd`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnReturns the operation result as `Int`.
functionos.process::Pipe.init
Signature
func init(self: os.process.Pipe, read_fd: Int = -1, write_fd: Int = -1) -> Void func init(self: os.process.Pipe, read_fd: Int = -1, write_fd: Int = -1) -> Void {
self.read_fd = read_fd;
self.write_fd = write_fd;@briefInitializes a `Pipe` instance.
@detailsEstablishes the initial field state for `Pipe` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- read_fdFile descriptor used for reading data from a pipe, socket, or file.
- write_fdFile descriptor used for writing data to a pipe, socket, or file.
@returnVoid
functionos.process::Pipe.close_read
Signature
func close_read(self: os.process.Pipe) -> ErrCode func close_read(self: os.process.Pipe) -> ErrCode {
if self.closed_read {
return std.OK;@briefCloses resources with `Pipe.close_read`.
@detailsExecutes the `close_read` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::Pipe.close_write
Signature
func close_write(self: os.process.Pipe) -> ErrCode func close_write(self: os.process.Pipe) -> ErrCode {
if self.closed_write {
return std.OK;@briefCloses resources with `Pipe.close_write`.
@detailsExecutes the `close_write` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::Pipe.close
Signature
func close(self: os.process.Pipe) -> ErrCode func close(self: os.process.Pipe) -> ErrCode {
let read_err: ErrCode = self.close_read();
let write_err: ErrCode = self.close_write();@briefCloses resources and makes later operations unavailable with `Pipe.close`.
@detailsExecutes the `close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::Pipe.read
Signature
func read(self: os.process.Pipe, max_bytes: Int) -> String, ErrCode func read(self: os.process.Pipe, max_bytes: Int) -> String, ErrCode {
if self.closed_read || self.read_fd < 0 || max_bytes < 0 {
return "", std.ERR_INVALID;@briefReads data with `Pipe.read`.
@detailsExecutes the `read` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::Pipe.write
Signature
func write(self: os.process.Pipe, data: String) -> Int, ErrCode func write(self: os.process.Pipe, data: String) -> Int, ErrCode {
if self.closed_write || self.write_fd < 0 {
return 0, std.ERR_INVALID;@briefWrites data with `Pipe.write`.
@detailsExecutes the `write` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::Pipe.dispose
Signature
func dispose(self: os.process.Pipe) -> Void func dispose(self: os.process.Pipe) -> Void {
_ = self.close();
}@briefExplicitly releases resources owned by `Pipe`.
@detailsThis method deterministically cleans up file descriptors, network connections, native handles, buffers, or other external resources. Implementations should be idempotent where possible, and repeated calls must not corrupt object state.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionos.process::Pipe.deinit
Signature
func deinit(self: os.process.Pipe) -> Void func deinit(self: os.process.Pipe) -> Void {
_ = self.close();
}@briefReleases fallback resources at the end of the `Pipe` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionos.process::spawn_shell
Signature
func spawn_shell(cmd: String) -> Intfunc spawn_shell(cmd: String) -> Int {
return __spawn_shell(cmd);
}@briefProvides the system library operation `spawn_shell`.
@detailsExecutes the `spawn_shell` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- cmdCommand string or command code sent to a process, protocol, or runtime binding.
@returnReturns the operation result as `Int`.
functionos.process::exec_capture_raw
Signature
func exec_capture_raw(cmd: String) -> Stringfunc exec_capture_raw(cmd: String) -> String {
return __exec_capture(cmd);
}@briefProvides the system library operation `exec_capture_raw`.
@detailsExecutes the `exec_capture_raw` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- cmdCommand string or command code sent to a process, protocol, or runtime binding.
@returnReturns the operation result as `String`.
functionos.process::exec
Signature
func exec(cmd: String) -> Int, ErrCodefunc exec(cmd: String) -> Int, ErrCode {
let rc: Int = __spawn_shell(cmd);
if rc == 0 {@briefProvides the system library operation `exec`.
@detailsExecutes the `exec` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- cmdCommand string or command code sent to a process, protocol, or runtime binding.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::exec_capture
Signature
func exec_capture(cmd: String) -> String, ErrCodefunc exec_capture(cmd: String) -> String, ErrCode {
return __exec_capture(cmd), std.OK;
}@briefProvides the system library operation `exec_capture`.
@detailsExecutes the `exec_capture` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- cmdCommand string or command code sent to a process, protocol, or runtime binding.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::exit
Signature
func exit(code: Int) -> Voidfunc exit(code: Int) -> Void {
_ = __os_exit(code);
return;@briefProvides the system library operation `exit`.
@detailsExecutes the `exit` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- codeNumeric status, error, signal, opcode, or platform code handled by this API.
@returnVoid
functionos.process::args
Signature
func args(argc: Int, argv: Int) -> collections.Vector<String>, ErrCodefunc args(argc: Int, argv: Int) -> collections.Vector<String>, ErrCode {
let out: collections.Vector<String> = new collections.Vector<String>();
loop (let arg_index: Int = 0; arg_index < argc; arg_index += 1) {@briefProvides the system library operation `args`.
@detailsExecutes the `args` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- argcNumber of command-line or native arguments available in `argv`.
- argvNative pointer or vector containing command-line argument values.
@returnReturns `collections.Vector<String>, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::argv_get
Signature
func argv_get(argc: Int, argv: Int, idx: Int) -> String, ErrCodefunc argv_get(argc: Int, argv: Int, idx: Int) -> String, ErrCode {
if idx < 0 || idx >= argc {
return "", std.ERR_INVALID;@briefProvides the system library operation `argv_get`.
@detailsExecutes the `argv_get` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- argcNumber of command-line or native arguments available in `argv`.
- argvNative pointer or vector containing command-line argument values.
- idxZero-based index.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::pid
Signature
func pid() -> Intfunc pid() -> Int {
return __process_getpid();
}@briefProvides the system library operation `pid`.
@detailsExecutes the `pid` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionos.process::ppid
Signature
func ppid() -> Intfunc ppid() -> Int {
return __process_getppid();
}@briefProvides the system library operation `ppid`.
@detailsExecutes the `ppid` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functionos.process::fork
Signature
func fork() -> Int, ErrCodefunc fork() -> Int, ErrCode {
let pid: Int = __process_fork();
if pid >= 0 {@briefProvides the system library operation `fork`.
@detailsExecutes the `fork` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::clone
Signature
func clone(flags: Int = 0) -> Int, ErrCodefunc clone(flags: Int = 0) -> Int, ErrCode {
let pid: Int = __process_clone(flags);
if pid >= 0 {@briefProvides the system library operation `clone`.
@detailsExecutes the `clone` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- flagsBitmask of option flags that controls how the operation is performed.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::wait_pid
Signature
func wait_pid(pid: Int) -> Int, ErrCodefunc wait_pid(pid: Int) -> Int, ErrCode {
let status: Int = __process_wait_pid(pid);
if status >= 0 {@briefProvides the system library operation `wait_pid`.
@detailsExecutes the `wait_pid` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- pidOperating-system process identifier targeted by the operation.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::pipe
Signature
func pipe() -> os.process.Pipe, ErrCodefunc pipe() -> os.process.Pipe, ErrCode {
let pair: Int = __process_pipe();
if pair == 0 {@briefProvides the system library operation `pipe`.
@detailsExecutes the `pipe` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns `os.process.Pipe, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::close_fd
Signature
func close_fd(fd: Int) -> ErrCodefunc close_fd(fd: Int) -> ErrCode {
if __posix_close_fd(fd) == 0 {
return std.OK;@briefCloses resources with `close_fd`.
@detailsExecutes the `close_fd` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::read_fd
Signature
func read_fd(fd: Int, max_bytes: Int) -> String, ErrCodefunc read_fd(fd: Int, max_bytes: Int) -> String, ErrCode {
if fd < 0 || max_bytes < 0 {
return "", std.ERR_INVALID;@briefReads data with `read_fd`.
@detailsExecutes the `read_fd` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionos.process::write_fd
Signature
func write_fd(fd: Int, data: String) -> Int, ErrCodefunc write_fd(fd: Int, data: String) -> Int, ErrCode {
let n: Int = __posix_write_fd(fd, data);
if n < 0 {@briefWrites data with `write_fd`.
@detailsExecutes the `write_fd` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- fdOperating-system file descriptor or socket descriptor.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
Variables
Class fields (var).
varos.process::Pipe.read_fd
Type
Int@brief`read_fd` field.
@detailsHolds the `read_fd` value for each `Pipe` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var read_fd: Int;
/*
@brief `write_fd` field.varos.process::Pipe.write_fd
Type
Int@brief`write_fd` field.
@detailsHolds the `write_fd` value for each `Pipe` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var write_fd: Int;
/*
@brief `closed_read` field.varos.process::Pipe.closed_read
Type
Bool@brief`closed_read` field.
@detailsHolds the `closed_read` value for each `Pipe` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
var closed_read: Bool;
/*
@brief `closed_write` field.varos.process::Pipe.closed_write
Type
Bool@brief`closed_write` field.
@detailsHolds the `closed_write` value for each `Pipe` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
var closed_write: Bool;
/*