diff options
Diffstat (limited to 'std.py')
| -rw-r--r-- | std.py | 16 | 
1 files changed, 15 insertions, 1 deletions
| @@ -124,7 +124,19 @@ def std_literal_to_string(arg):  # shell  def std_shell(arg):      assert isinstance(arg, NebString) -    subprocess.run(arg.value) +    lst = arg.value.split(" ") +    subprocess.run(lst) +    return NebBool(True) + +def std_shell_pipe(args): +    prev = None +    stdout = subprocess.PIPE +    for idx, arg in enumerate(args.items): +        if idx == len(args.items) - 1: +            stdout = None +        lst = arg.value.split(" ") +        ret = subprocess.run(lst, stdout=stdout, input=prev) +        prev = ret.stdout      return NebBool(True)  def evaluate_expression(expr): @@ -229,5 +241,7 @@ def build_std():      # shell      shell_string = FuncImpl(NebFunction("$", [NebString], NebBool), std_shell)      STD["$"] = [shell_string] +    shell_pipe = FuncImpl(NebFunction("$|", [NebList], NebBool), std_shell_pipe) +    STD["$|"] = [shell_pipe]  build_std() | 
