OILS / client / run.sh View on Github | oilshell.org

60 lines, 37 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# client/run.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -o errexit
9
10source build/dev-shell.sh # python3
11source devtools/run-task.sh
12
13py-demo() {
14 echo mystdin | client/headless_demo.py --sh-binary bin/osh
15}
16
17cpp-demo() {
18 local bin=_bin/cxx-dbg/osh
19 ninja $bin
20 echo mystdin | client/headless_demo.py --sh-binary $bin
21}
22
23errors() {
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
40demo-pty() {
41 echo mystdin | client/headless_demo.py --to-new-pty
42}
43
44soil-run-py() {
45 py-demo
46 echo
47
48 errors
49 echo
50}
51
52soil-run-cpp() {
53 which python3
54 echo
55
56 cpp-demo
57}
58
59
60run-task "$@"