Crate conch_runtime [] [src]

A library for executing programs written in the shell programming language.

This library offers executing already parsed shell commands as defined by the POSIX.1-2008 standard. This runtime attempts to remain agnostic to the specific Abstract Syntax Tree format a parser could produce, as well as agnostic to features supported by the OS to be as cross platform as possible.

Specifically implementations are provided for all the default AST nodes produced by the conch-parser crate. Unlike other Unix shells, this library supports Windows1 and can likely be extended for other operating systems as well.

1Major features are reasonably supported in Windows to the extent possible. Due to OS differences (e.g. async I/O models) and inherent implementation exepectations of the shell programming language, certain features may require additional runtime costs, or may be limited in nature (e.g. inheriting arbitrary numbered file descriptors [other than stdio] is difficult/impossible due to the way Windows addresses file handles).

Supported Cargo Features

  • clippy: compile with clippy lints enabled
  • conch-parser: enable implementations on the default AST types provided by the conch-parser crate
  • top-level: enable compiling implementations on thte TopLevel{Command,Word} provided by the conch-parser crate (useful for disabling to speed up compile times during local development)

Reexports

pub use self::spawn::Spawn;

Modules

env

This module defines various interfaces and implementations of shell environments. See the documentation around Env or DefaultEnv to get started.

error

A module defining the various kinds of errors that may arise while executing commands.

eval

A module for evaluating arbitrary shell components such as words, parameter subsitutions, redirections, and others.

future

This module defines various traits and adapters for bridging command execution with futures.

io

Defines interfaces and methods for doing OS agnostic file IO operations.

os

Platform specific extensions.

path

Defines helpers and utilities for working with file system paths

spawn

Defines methods for spawning commands into futures.

Macros

impl_generic_builtin_cmd
impl_generic_builtin_cmd_no_spawn
impl_trivial_builtin_cmd

Implements a builtin command which accepts no arguments, has no side effects, and simply exits with some status.

Enums

ExitStatus

Describes the result of a process after it has terminated.

Constants

EXIT_CMD_NOT_EXECUTABLE

Exit code for commands which are not executable.

EXIT_CMD_NOT_FOUND

Exit code for missing commands.

EXIT_ERROR

Exit code for commands that did not exit successfully.

EXIT_SUCCESS

Exit code for commands that exited successfully.

STDERR_FILENO

File descriptor for standard error.

STDIN_FILENO

File descriptor for standard input.

STDOUT_FILENO

File descriptor for standard output.

Traits

RefCounted

A convenience trait to abstract over Arc and Rc APIs.

Type Definitions

Fd

The type that represents a file descriptor within shell scripts.