|
| 1 | + $ cat > dune-project << EOF |
| 2 | + > (lang dune 2.2) |
| 3 | + > (using action-plugin 0.1) |
| 4 | + > EOF |
| 5 | + |
| 6 | + $ cat > dune <<EOF |
| 7 | + > (executable |
| 8 | + > (name exit) |
| 9 | + > (modules exit)) |
| 10 | + > (rule (with-stdout-to exit.ml (echo "let () = exit (int_of_string Sys.argv.(1))"))) |
| 11 | + > EOF |
| 12 | + |
| 13 | + $ cat >> dune <<EOF |
| 14 | + > (rule |
| 15 | + > (alias f) |
| 16 | + > (action (with-accepted-exit-codes |
| 17 | + > 1 |
| 18 | + > (with-stdout-to out.txt |
| 19 | + > (run ./exit.exe 1))))) |
| 20 | + > EOF |
| 21 | + |
| 22 | + $ dune build --display=short --root . @f |
| 23 | + ocamldep .exit.eobjs/exit.ml.d |
| 24 | + ocamlc .exit.eobjs/byte/dune__exe__Exit.{cmi,cmo,cmt} |
| 25 | + ocamlopt .exit.eobjs/native/dune__exe__Exit.{cmx,o} |
| 26 | + ocamlopt exit.exe |
| 27 | + exit out.txt |
| 28 | + |
| 29 | + $ cat >> dune <<EOF |
| 30 | + > (rule |
| 31 | + > (alias f2) |
| 32 | + > (action (with-accepted-exit-codes |
| 33 | + > 1 |
| 34 | + > (with-stdin-from input |
| 35 | + > (chdir . |
| 36 | + > (run ./exit.exe 1)))))) |
| 37 | + > EOF |
| 38 | + |
| 39 | + $ echo "Hello, Dune!" > input |
| 40 | + $ dune build --display=short --root . @f2 |
| 41 | + exit alias f2 |
| 42 | + |
| 43 | + $ cat >> dune <<EOF |
| 44 | + > (rule |
| 45 | + > (alias f3) |
| 46 | + > (action (with-accepted-exit-codes |
| 47 | + > 0 |
| 48 | + > (setenv VAR myvar |
| 49 | + > (chdir . |
| 50 | + > (system "echo \$VAR")))))) |
| 51 | + > EOF |
| 52 | + |
| 53 | + $ dune build --display=short --root . @f3 |
| 54 | + sh alias f3 |
| 55 | + myvar |
| 56 | + |
| 57 | + $ cat >> dune <<EOF |
| 58 | + > (rule |
| 59 | + > (alias f4) |
| 60 | + > (action (with-accepted-exit-codes |
| 61 | + > 0 |
| 62 | + > (setenv VAR myvar |
| 63 | + > (ignore-stdout |
| 64 | + > (bash "echo \$VAR")))))) |
| 65 | + > EOF |
| 66 | + |
| 67 | + $ dune build --display=short --root . @f4 |
| 68 | + bash alias f4 |
| 69 | + |
| 70 | + $ cat >> dune <<EOF |
| 71 | + > (rule |
| 72 | + > (alias f5) |
| 73 | + > (action (with-accepted-exit-codes |
| 74 | + > 0 |
| 75 | + > (setenv VAR myvar |
| 76 | + > (with-stdin-from input |
| 77 | + > (chdir . |
| 78 | + > (with-stdout-to out2.txt |
| 79 | + > (run ./exit.exe 1)))))))) |
| 80 | + > EOF |
| 81 | + $ echo "Hello, Dune!" > input |
| 82 | + $ dune build --display=short --root . @f5 |
| 83 | + exit out2.txt (exit 1) |
| 84 | + (cd _build/default && ./exit.exe 1) < _build/default/input > _build/default/out2.txt |
| 85 | + [1] |
| 86 | + |
| 87 | + $ cat >> dune <<EOF |
| 88 | + > (rule |
| 89 | + > (alias g) |
| 90 | + > (action |
| 91 | + > (with-accepted-exit-codes |
| 92 | + > (not 0) |
| 93 | + > (setenv VAR myvar |
| 94 | + > (chdir . |
| 95 | + > (with-stdout-to out.txt |
| 96 | + > (dynamic-run ./exit.exe 1))))))) |
| 97 | + > EOF |
| 98 | + |
| 99 | + $ dune build --display=short --root . @g |
| 100 | + File "dune", line 46, characters 3-98: |
| 101 | + 46 | (setenv VAR myvar |
| 102 | + 47 | (chdir . |
| 103 | + 48 | (with-stdout-to out.txt |
| 104 | + 49 | (dynamic-run ./exit.exe 1))))))) |
| 105 | + Error: Only "run", "bash", "system", "chdir", "setenv", "ignore-<outputs>", |
| 106 | + "with-stdin-from" and "with-<outputs>-to" can be nested under |
| 107 | + "with-accepted-exit-codes" |
| 108 | + [1] |
0 commit comments