Module shell

Shell operations.

Info:

Functions

command(cwd, env, creates, removes)
Run a command via execve(3).

Promiser:

    command to execute

Parameters:

  • cwd current working directory
  • env space separated environment variables
  • creates a filename, if found will not run the command
  • removes a filename, if not found will not run the command

Usage:

    shell.command("touch test"){
            cwd = "/tmp",
            env = "test=this whatever=youwant",
        creates = "test"
    }
system(creates, removes)
Run a script or command via os.execute.
STDIN and STDERR are closed and STDOUT is piped to /dev/null

Promiser:

    script or command to execute

Aliases:

    script

Parameters:

  • creates a filename, if found will not run the script
  • removes a filename, if not found will not run the script

Usage:

    shell.system("/root/test.sh")()
popen(cwd, creates, removes, expects)
Run a command via io.popen.

Promiser:

    command to execute

Parameters:

  • cwd current working directory
  • creates a filename, if found will not run the command
  • removes a filename, if not found will not run the command
  • expects instead of the exit code, use a string match as a test for success

Usage:

    shell.popen("ls -la"){
            cwd = "/tmp",
        expects = ".X11-unix"
    }
popen3(cwd, env, creates, removes, stdin, stdout, stderr, error)
Run a command via lib.exec which can expect strings from STDIN, STDOUT or STDERR

Promiser:

    command to execute

Parameters:

  • cwd current working directory
  • env space separated string of environment variables
  • creates a filename, if found will not run the command
  • removes a filename, if not found will not run the command
  • stdin pipe a string from STDIN
  • stdout test for a string from STDOUT
  • stderr test for a string from STDERR
  • error ignore errors when set to "ignore" [Default: false]

Usage:

    shell.popen3("ls"){
           cwd = "/tmp",
        stdout = ".X11-unix"
    }
generated by LDoc 1.4.6 Last updated 2017-05-09 15:50:38