Skip to content

sys

The sys module exposes basic information and types associated with systems and platforms supported by Do.

Types

TypeDescription
AddrInUseError A network address is already in use.
AddrNotAvailableError A requested network address is unavailable.
AlreadyExistsError Raised when creating or renaming something would conflict with an existing filesystem path or other system resource.
ArgumentListTooLongError A system argument list is too long.
BrokenPipeError A pipe or connection was closed by its reader.
ConnectionAbortedError A connection was aborted.
ConnectionRefusedError A connection attempt was refused.
ConnectionResetError A connection was reset.
CpuInfo CPU information for the active VFS target, returned by cpu_info.
CrossesDevicesError An operation cannot cross device boundaries.
DeadlockError An operation would cause a deadlock.
DirectoryNotEmptyError A directory or key is not empty.
Error Error is raised for system and I/O failures.
ErrorCode Native system error code.
ExecutableFileBusyError An executable file is busy.
FileTooLargeError A file exceeds a supported size limit.
HostUnreachableError A network host is unreachable.
InterruptedError A system operation was interrupted.
InvalidDataError Input data is malformed or violates a protocol.
InvalidFilenameError A filename is invalid.
InvalidInputError Raised when a system operation receives invalid input.
IsADirectoryError A file operation targeted a directory.
NetworkDownError The network is down.
NetworkUnreachableError A network is unreachable.
NotADirectoryError A path component is not a directory.
NotConnectedError An operation requires a connected endpoint.
NotFoundError Raised when a filesystem path, program, or other system resource cannot be found.
NotSeekableError A stream does not support seeking.
OsInfo Operating system information for the active VFS target, returned by os_info.
OutOfMemoryError A system operation could not allocate memory.
PermissionDeniedError Raised when a system operation is not permitted by filesystem, process, or platform access rules.
QuotaExceededError A storage quota was exceeded.
ReadOnlyFilesystemError An operation attempted to modify a read-only filesystem.
ResourceBusyError A system resource is busy.
StaleNetworkFileHandleError A network filesystem handle is stale.
StorageFullError A storage device is full.
TimedOutError Raised when a system operation times out.
TooManyLinksError A filesystem object has too many links.
UnexpectedEofError Input ended unexpectedly.
UnsupportedError Raised when a system operation is unsupported.
WouldBlockError An operation would block.
WriteZeroError A write operation wrote zero bytes.

Functions

cpu_info() -> CpuInfo

Returns CPU information for the current VFS target.

Example

let info = sys.cpu_info()
echo "running on $(info.arch) with $(info.logical_count) logical CPUs"

os_info() -> OsInfo

Returns operating system information for the current VFS target.

Example

if (sys.os_info().family == :WINDOWS:)
  echo "running on Windows"