Namespace: joker.os
v1.0Provides a platform-independent interface to operating system functionality.
Index
-
args
Function v1.0(args)
Returns a sequence of the command line arguments, starting with the program name (normally, joker).
-
chdir
Function v1.0(chdir dirname)
Chdir changes the current working directory to the named directory. If there is an error, an exception will be thrown. Returns nil.
-
cwd
Function v1.0(cwd)
Returns a rooted path name corresponding to the current directory. If the current directory can
be reached via multiple paths (due to symbolic links), cwd may return any one of them. -
env
Function v1.0(env)
Returns a map representing the environment.
-
exec
Function v1.0(exec name opts)
Executes the named program with the given arguments. opts is a map with the following keys (all optional):
:args - vector of arguments (all arguments must be strings),
:dir - if specified, working directory will be set to this value before executing the program,
:stdin - if specified, provides stdin for the program. Can be either a string or :pipe keyword.
If it's a string, the string's content will serve as stdin for the program. If it's :pipe,
Joker's stdin will be redirected to the program's stdin.
Returns a map with the following keys:
:success - whether or not the execution was successful,
:err-msg (present iff :success if false) - string capturing error object returned by Go runtime
:exit - exit code of program (or attempt to execute it),
:out - string capturing stdout of the program,
:err - string capturing stderr of the program. -
exit
Function v1.0(exit code)
Causes the current program to exit with the given status code.
-
ls
Function v1.0(ls dirname)
Reads the directory named by dirname and returns a list of directory entries sorted by filename.
-
mkdir
Function v1.0(mkdir name perm)
Creates a new directory with the specified name and permission bits.
-
set-env
Function v1.0(set-env key value)
Sets the specified key to the specified value in the environment.
-
sh
Function v1.0(sh name & arguments)
Executes the named program with the given arguments. Returns a map with the following keys:
:success - whether or not the execution was successful,
:err-msg (present iff :success if false) - string capturing error object returned by Go runtime
:exit - exit code of program (or attempt to execute it),
:out - string capturing stdout of the program,
:err - string capturing stderr of the program. -
sh-from
Function v1.0(sh-from dir name & arguments)
Executes the named program with the given arguments and working directory set to dir.
Returns a map with the following keys:
:success - whether or not the execution was successful,
:err-msg (present iff :success if false) - string capturing error object returned by Go runtime
:exit - exit code of program (or attempt to execute it),
:out - string capturing stdout of the program,
:err - string capturing stderr of the program. -
stat
Function v1.0(stat filename)
Returns a map describing the named file. The info map has the following attributes:
:name - base name of the file
:size - length in bytes for regular files; system-dependent for others
:mode - file mode bits
:modtime - modification time
:dir? - true if file is a directory