Documentation ¶
Overview ¶
Package cmd implements golang cmd functionality for lua.
Index ¶
Examples ¶
Constants ¶
View Source
const (
//Timeout default execution timeout in seconds
Timeout = 10
)
Variables ¶
This section is empty.
Functions ¶
func Exec ¶
Exec lua cmd.exec(command) return ({status=0, stdout="", stderr=""}, err)
Example ¶
cmd.exec()
state := lua.NewState() Preload(state) runtime.Preload(state) source := ` local cmd = require("cmd") local runtime = require("runtime") local command = "sleep 1" if runtime.goos() == "windows" then command = "timeout 1" end local result, err = cmd.exec(command) if err then error(err) end print(result.status) ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) }
Output: 0
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.