1 module orelang.operator.SystemOperator; 2 import orelang.operator.IOperator, 3 orelang.Engine, 4 orelang.Value; 5 6 import std.process, 7 std..string; 8 9 class SystemOperator : IOperator { 10 /** 11 * call 12 */ 13 public Value call(Engine engine, Value[] args) { 14 string[] args_strs; 15 16 foreach (arg; args) { 17 args_strs ~= engine.eval(arg).toString; 18 } 19 20 try { 21 auto pid = spawnProcess(args_strs);//execute(args_strs.join(" ")); 22 23 return new Value(wait(pid)); 24 } catch { 25 return new Value(-1); 26 } 27 } 28 }