Execute a system command: Difference between revisions
Content added Content deleted
m (→{{header|FutureBasic}}: Add 'print' to FB 7.0.23 entry. Remove 'dim as' from open unix entry) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 2,238: | Line 2,238: | ||
However, if Wren is embedded in (say) a suitable Go program, then we can ask the latter to do it for us. |
However, if Wren is embedded in (say) a suitable Go program, then we can ask the latter to do it for us. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">/* Execute_a_system_command.wren */ |
||
class Command { |
class Command { |
||
foreign static exec(name, param) // the code for this is provided by Go |
foreign static exec(name, param) // the code for this is provided by Go |
||
Line 2,249: | Line 2,249: | ||
which we embed in the following Go program and run it. |
which we embed in the following Go program and run it. |
||
{{libheader|WrenGo}} |
{{libheader|WrenGo}} |
||
<syntaxhighlight lang="go">/* |
<syntaxhighlight lang="go">/* Execute_a_system_command.go*/ |
||
package main |
package main |
||
Line 2,280: | Line 2,280: | ||
func main() { |
func main() { |
||
vm := wren.NewVM() |
vm := wren.NewVM() |
||
fileName := " |
fileName := "Execute_a_system_command.wren" |
||
methodMap := wren.MethodMap{"static exec(_,_)": execCommand} |
methodMap := wren.MethodMap{"static exec(_,_)": execCommand} |
||
classMap := wren.ClassMap{"Command": wren.NewClass(nil, nil, methodMap)} |
classMap := wren.ClassMap{"Command": wren.NewClass(nil, nil, methodMap)} |