Get system command output: Difference between revisions
m
→{{header|Wren}}: Minor tidy
m (→{{header|Wren}}: Minor tidy) |
|||
Line 1,760:
However, if Wren is embedded in (say) a suitable Go program, then we can ask the latter to do it for us.
<syntaxhighlight lang="
class Command {
foreign static output(name, param) // the code for this is provided by Go
Line 1,769:
which we embed in the following Go program and run it.
{{libheader|WrenGo}}
<syntaxhighlight lang="go">/*
package main
Line 1,800:
func main() {
vm := wren.NewVM()
fileName := "
methodMap := wren.MethodMap{"static output(_,_)": getCommandOutput}
classMap := wren.ClassMap{"Command": wren.NewClass(nil, nil, methodMap)}
|