Closed dundalek closed 1 year ago
Given:
echo a | tee /dev/stderr >& /dev/null
Expected: Should be translated as a script that prints nothing.
Actual: Fails with Don't know how to translate redirect
Don't know how to translate redirect
For comparison stdout redirect:
echo a | tee /dev/stderr > /dev/null
gets translated as:
(shell {:out "/dev/null", :in (:out (shell {:out :string} "echo" "a"))} "tee" "/dev/stderr")
I found out that babashka/process supports redirecting err to out with :err :out, so we could translate the initial repro as:
:err :out
(shell {:out "/dev/null" :err :out :in (:out (shell {:out :string} "echo" "a"))} "tee" "/dev/stderr")
Great bug report, thanks
Given:
Expected: Should be translated as a script that prints nothing.
Actual: Fails with
Don't know how to translate redirect
Stacktrace
``` {"Op" 59, "Word" {"Parts" [{"Type" "Lit", "Value" "/dev/null"}]}} ----- Error -------------------------------------------------------------------- Type: java.lang.Exception Message: Don't know how to translate redirect Location: /home/me/.gitlibs/libs/io.github.pesterhazy/bash2bb/57c4f925273e2146b7ba8c392e3268775cef0616/src/bash2bb/core.clj:142:40 ----- Context ------------------------------------------------------------------ 138: (assoc opts :err 'System/out) 139: :else 140: (do 141: (pp redir) 142: (throw (Exception. (str "Don't know how to translate redirect"))))))) ^--- Don't know how to translate redirect 143: 144: 63 ;; here-string 145: (assoc opts :in (-> redir (get "Word") (get "Parts") only (get "Value"))) 146: ;; else 147: (do ----- Stack trace -------------------------------------------------------------- bash2bb.core - /home/me/.gitlibs/libs/io.github.pesterhazy/bash2bb/57c4f925273e2146b7ba8c392e3268775cef0616/src/bash2bb/core.clj:142:40 clojure.core/reduce -For comparison stdout redirect:
gets translated as:
I found out that babashka/process supports redirecting err to out with
:err :out
, so we could translate the initial repro as: