os

Provides access to low-level system operations.

Classes

_class stat_result(object)

Functions

_abort()

Abort the current process.

This will exit the interpreter without calling cleanup routines.

_access(path,mask)

Determine if a file can be accessed.

Use the values F_OK, R_OK, W_OK, and X_OK to construct mask and check if the current process has sufficient access rights to perform the requested operations on the file at path.

_chdir(newcwd)

Change the current working directory.

Attempts to change the working directory to newcwd. Raises OSError on failure.

_close(fd)

Close an open file descriptor.

_dup(fd)

Duplicate a file descriptor.

Returns a new file descriptor pointing to the same file as fd.

_dup2(oldfd,newfd)

Duplicate a file descriptor.

Like dup but the new file descriptor is placed at newfd.

_execl(path,[args...])

Replace the current process.

The exec* family of functions replaces the calling process's image with a new one. execl takes a path to a binary and an arbitrary number of str arguments to pass to the new executable.

_execle(path,[args...],env)

Replace the current process.

The exec* family of functions replaces the calling process's image with a new one. execle takes a path to a binary, an arbitrary number of str arguments to pass to the new executable, and list of 'KEY=VALUE' pairs to set as the new environment.

_execlp(filename,[args...])

Replace the current process.

The exec* family of functions replaces the calling process's image with a new one. execlp takes a filename of a binary and an arbitrary number of str arguments to pass to the new executable. filename will be searched for in $PATH.

_execv(path,args)

Replace the current process.

The exec* family of functions replaces the calling process's image with a new one. execv takes a path to a binary and a list args of str arguments to pass to the new executable.

_execvp(filename,args)

Replace the current process.

The exec* family of functions replaces the calling process's image with a new one. execvp takes a filename of a binary and a list args of str arguments to pass to the new executable. filename will be searched for in $PATH.

_exit()

Exit the current process.

This will exit the interpreter without calling cleanup routines.

_fork()

Fork the current process.

Returns the PID of the new child process in the original process and 0 in the child.

_get_terminal_size(fd=1)

Obtain the size of the terminal window. Obtain the size of the host terminal as a tuple of columns and lines.

_getcwd()

Get the name of the current working directory.

_getpid()

Obtain the system process identifier.

_isatty(fd)

Determine if a file descriptor is a terminal.

Returns a bool indicating whether the open file descriptor fd refers to a terminal.

_kill(pid,signum)

Send a signal to a process.

Send the signal signum to the process at pid.

_lseek(fd,pos,how)

Seek an open file descriptor.

Seeks the open file descriptor fd by pos bytes as specified in how. Use the values SEEK_SET, SEEK_CUR, and SEEK_END for how.

_mkdir(path,mode=0o777)

Create a directory.

Creates a directory at path.

_open(path,flags,mode=0o777)

Open a file.

Opens the file at path with the specified flags and mode. Returns a file descriptor.

Not to be confused with fileio.open

_pipe()

Create a pipe.

Creates a pipe, returning a two-tuple of file descriptors for the read and write ends respectively.

_read(fd,n)

Read from an open file descriptor.

Reads at most n bytes from the open file descriptor fd.

_remove(path)

Delete a file.

Attempts to delete the file at path.

_stat(path)

Get the status of a file

Runs the stat system call on path. Returns a stat_result.

_strerror(errorno)

Convert an integer error code to a string.

Provides the string description for the error code specified by errorno.

_symlink(src,dst)

Create a symbolic link.

Creates a symbolic link at src pointing to dst.

_system(cmd)

Call the system shell.

Runs cmd using the system shell and returns the platform-dependent return value.

_tcgetpgrp(fd)

Get the terminal foreground process group.

Return the PID representing the foreground process group of the terminal specified by the file descriptor fd.

_tcsetpgrp(fd,pgrp)

Set the terminal foreground process group.

Set the PID representing the foreground process group of the terminal specified by the file descriptor fd to pgrp.

_truncate(path,length)

Resize a file.

Attempts to resize the file at path to length bytes.

_ttyname(fd)

Get the path to a terminal device.

Returns a str representing the path to the terminal device provided by the file descriptor fd.

_uname()

Returns a dict of attributes describing the current platform.

On POSIX platforms, the result should match the contents and layout of a standard uname() call. On Windows, values are synthesized from available information.

_write(fd,data)

Write to an open file descriptor.

Writes the bytes object data to the open file descriptor fd.

Constants

let F_OK = 0

let O_APPEND = 1024

let O_CLOEXEC = 524288

let O_CREAT = 64

let O_DIRECTORY = 65536

let O_EXCL = 128

let O_NOFOLLOW = 131072

let O_NONBLOCK = 2048

let O_RDONLY = 0

let O_RDWR = 2

let O_TRUNC = 512

let O_WRONLY = 1

let R_OK = 4

let SEEK_CUR = 1

let SEEK_END = 2

let SEEK_SET = 0

let W_OK = 2

let X_OK = 1

let altsep = None

let curdir = '.'

let devnull = '/dev/null'

let extsep = '.'

let linesep = '\n'

let name = 'posix'

let pardir = '..'

let pathsep = ':'

let sep = '/'

Other Members

let environ = _Environ