1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Usage:
|
4 | # client/run.sh <function name>
|
5 |
|
6 | set -o nounset
|
7 | set -o pipefail
|
8 | set -o errexit
|
9 |
|
10 | source build/dev-shell.sh # python3
|
11 | source devtools/run-task.sh
|
12 |
|
13 | py-demo() {
|
14 | echo mystdin | client/headless_demo.py --sh-binary bin/osh
|
15 | }
|
16 |
|
17 | cpp-demo() {
|
18 | local bin=_bin/cxx-dbg/osh
|
19 | ninja $bin
|
20 | echo mystdin | client/headless_demo.py --sh-binary $bin
|
21 | }
|
22 |
|
23 | errors() {
|
24 | set +o errexit
|
25 |
|
26 | # Invalid netstring
|
27 | client/headless_demo.py 'zzz'
|
28 | echo status=$? # TODO: assert status
|
29 |
|
30 | # Invalid command
|
31 | client/headless_demo.py '3:foo,'
|
32 | echo status=$?
|
33 |
|
34 | # Command doesn't have file descriptors
|
35 | client/headless_demo.py '4:ECMD,'
|
36 | echo status=$?
|
37 | }
|
38 |
|
39 | # Hm what is this suppose to do? It waits for input
|
40 | demo-pty() {
|
41 | echo mystdin | client/headless_demo.py --to-new-pty
|
42 | }
|
43 |
|
44 | soil-run-py() {
|
45 | py-demo
|
46 | echo
|
47 |
|
48 | errors
|
49 | echo
|
50 | }
|
51 |
|
52 | soil-run-cpp() {
|
53 | which python3
|
54 | echo
|
55 |
|
56 | cpp-demo
|
57 | }
|
58 |
|
59 |
|
60 | run-task "$@"
|