Shells in OCaml
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

Last redirects for now

+21 -1
+15 -1
src/lib/eval.ml
··· 170 170 in 171 171 let fd = Eio_unix.Resource.fd_opt w |> Option.get in 172 172 Some (Types.Redirect (n, fd, `Blocking)) 173 - | _ -> Fmt.failwith "Redirections ...") 173 + | Io_op_greatand -> ( 174 + match file with 175 + | [ WordLiteral "-" ] -> 176 + if n = 0 then Some (Types.Close Eio_unix.Fd.stdin) 177 + else 178 + let fd = fd_of_int ~sw n in 179 + Some (Types.Close fd) 180 + | [ WordLiteral m ] when Option.is_some (int_of_string_opt m) -> 181 + let m = int_of_string m in 182 + Some 183 + (Types.Redirect 184 + (n, fd_of_int ~close_unix:false ~sw m, `Blocking)) 185 + | _ -> None) 186 + | Io_op_clobber -> Fmt.failwith ">| not supported yet." 187 + | Io_op_lessgreat -> Fmt.failwith "<> not support yet.") 174 188 | Ast.IoRedirect_IoHere _ -> 175 189 Fmt.failwith "HERE documents not yet implemented!" 176 190
+6
test/simple.t
··· 98 98 $ osh -c "echo world >> hello.txt && cat hello.txt" 99 99 hello 100 100 world 101 + 102 + Redirection of fds 103 + 104 + $ osh -c "echo hello 3>out.txt >&3" 105 + $ cat out.txt 106 + hello