File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 88 "fmt"
99 "github.com/covrom/decnum"
1010 uuid "github.com/satori/go.uuid"
11+ "log"
1112 "os"
13+ "os/exec"
1214 "path/filepath"
1315 "reflect"
1416 "runtime"
@@ -397,6 +399,27 @@ func Import(env *Env) *Env {
397399 return nil
398400 }))
399401
402+ env .DefineS ("ВыполнитьКомандуСистемы" , VMFunc (func (args VMSlice , rets * VMSlice ) error {
403+ if len (args ) != 2 {
404+ env .Println ()
405+ return nil
406+ }
407+ cmd := string (args [0 ].(VMString ))
408+
409+ rv := make ([]string , 0 )
410+ params := args [1 ].(VMSlice )
411+ for i , _ := range params {
412+ rv = append (rv , params [i ].(VMStringer ).String ())
413+ }
414+
415+ out , err := exec .Command (cmd , rv ... ).Output ()
416+ if err != nil {
417+ log .Fatal (err )
418+ }
419+ rets .Append (VMString (out ))
420+ return nil
421+ }))
422+
400423 env .DefineS ("чтениеизстрокиxml" , VMFunc (func (args VMSlice , rets * VMSlice ) error {
401424 if len (args ) != 1 {
402425 env .Println ()
You can’t perform that action at this time.
0 commit comments