*** Running test-ast-formats
(C (w <Lit_Chars echo>) (w <Lit_Chars hi>))
(command.Simple
  blame_tok:(Token
    id:Lit_Chars
    length:4
    col:0
    line:(SourceLine line_num:1 content:"echo hi" src:(source.CFlag))
  )
  more_env:[]
  words:[
    (CompoundWord parts:[...0x7fe76c5c89a8])
    (CompoundWord
      parts:[(Token id:Lit_Chars length:2 col:5 line:...0x7fe76c5e6788)]
    )
  ]
  is_last_cmd:F
)
OK  test-ast-formats
*** Running test-exit-builtin-interactive
osh-0.28$ one
OK  test-exit-builtin-interactive
*** Running test-help
Oils 0.28.0		https://oils.pub/

~~~ oils-usage ~~~

bin/oils-for-unix is an executable that contains OSH, YSH, and more.

Usage:
    oils-for-unix MAIN_NAME ARG*
    MAIN_NAME ARG*

It behaves like busybox.  The command name can be passed as the first argument:

    oils-for-unix ysh -c 'echo hi'

More commonly, it's invoked through a symlink like 'ysh', which causes it to
behave like that command:

    ysh -c 'echo hi'

~~~ shell-flags ~~~

osh and ysh accept standard POSIX shell flags, like:

    bin/osh -o errexit -c 'false'
    bin/ysh -n myfile.ysh
    bin/ysh +o errexit -c 'false; echo ok'

They also accept these flags:

    --eval FILE
        Evaluate the given file, similar to the 'source' builtin.  Specify it
        multiple times to run multiple files.  If the errexit option is on
        (e.g. in YSH), then the shell stops when $? is non-zero after
        evaluating a file.

    --eval-pure FILE
        Like --eval, but disallow I/O (known as "pure mode").

    --location-str
        Use this string to display error messages.
        See 'help sourceCode' for an example.

    --location-start-line
        Use this line number offset to display error messages.

    --tool            Run a tool instead of the shell (cat-em|syntax-tree)
    -n                Parse the program but don't execute it.  Print the AST.
    --ast-format FMT  The format for the AST (text|text-abbrev)

Examples:

    ysh --eval one.ysh --eval two.ysh -c 'echo hi'  # Run 2 files first
    osh -n -c 'hello'                               # pretty-print the AST
    ysh --ast-format text -n -c 'hello'             # in unabridged format

Oils 0.28.0		https://oils.pub/

~~~ osh-usage ~~~

bin/osh is compatible with POSIX shell, bash, and other shells.

Usage:
   osh FLAG* SCRIPT ARG*
   osh FLAG* -c COMMAND ARG*
   osh FLAG*

Examples:
    osh -c 'echo hi'
    osh myscript.sh
    echo 'echo hi' | osh

~~~ shell-flags ~~~

osh and ysh accept standard POSIX shell flags, like:

    bin/osh -o errexit -c 'false'
    bin/ysh -n myfile.ysh
    bin/ysh +o errexit -c 'false; echo ok'

They also accept these flags:

    --eval FILE
        Evaluate the given file, similar to the 'source' builtin.  Specify it
        multiple times to run multiple files.  If the errexit option is on
        (e.g. in YSH), then the shell stops when $? is non-zero after
        evaluating a file.

    --eval-pure FILE
        Like --eval, but disallow I/O (known as "pure mode").

    --location-str
        Use this string to display error messages.
        See 'help sourceCode' for an example.

    --location-start-line
        Use this line number offset to display error messages.

    --tool            Run a tool instead of the shell (cat-em|syntax-tree)
    -n                Parse the program but don't execute it.  Print the AST.
    --ast-format FMT  The format for the AST (text|text-abbrev)

Examples:

    ysh --eval one.ysh --eval two.ysh -c 'echo hi'  # Run 2 files first
    osh -n -c 'hello'                               # pretty-print the AST
    ysh --ast-format text -n -c 'hello'             # in unabridged format

Oils 0.28.0		https://oils.pub/

~~~ ysh-usage ~~~

bin/ysh is the shell with data tYpes, influenced by pYthon, JavaScript, ...

Usage:
    ysh FLAG* SCRIPT ARG*
    ysh FLAG* -c COMMAND ARG*
    ysh FLAG*

Examples:
    ysh -c 'echo hi'
    ysh myscript.ysh
    echo 'echo hi' | ysh

Note that bin/ysh is the same as bin/osh with the ysh:all option group set:
    osh -o ysh:all -c 'echo hi'  # Same as YSH

~~~ shell-flags ~~~

osh and ysh accept standard POSIX shell flags, like:

    bin/osh -o errexit -c 'false'
    bin/ysh -n myfile.ysh
    bin/ysh +o errexit -c 'false; echo ok'

They also accept these flags:

    --eval FILE
        Evaluate the given file, similar to the 'source' builtin.  Specify it
        multiple times to run multiple files.  If the errexit option is on
        (e.g. in YSH), then the shell stops when $? is non-zero after
        evaluating a file.

    --eval-pure FILE
        Like --eval, but disallow I/O (known as "pure mode").

    --location-str
        Use this string to display error messages.
        See 'help sourceCode' for an example.

    --location-start-line
        Use this line number offset to display error messages.

    --tool            Run a tool instead of the shell (cat-em|syntax-tree)
    -n                Parse the program but don't execute it.  Print the AST.
    --ast-format FMT  The format for the AST (text|text-abbrev)

Examples:

    ysh --eval one.ysh --eval two.ysh -c 'echo hi'  # Run 2 files first
    osh -n -c 'hello'                               # pretty-print the AST
    ysh --ast-format text -n -c 'hello'             # in unabridged format

Oils 0.28.0		https://oils.pub/

~~~ osh-usage ~~~

bin/osh is compatible with POSIX shell, bash, and other shells.

Usage:
   osh FLAG* SCRIPT ARG*
   osh FLAG* -c COMMAND ARG*
   osh FLAG*

Examples:
    osh -c 'echo hi'
    osh myscript.sh
    echo 'echo hi' | osh

~~~ shell-flags ~~~

osh and ysh accept standard POSIX shell flags, like:

    bin/osh -o errexit -c 'false'
    bin/ysh -n myfile.ysh
    bin/ysh +o errexit -c 'false; echo ok'

They also accept these flags:

    --eval FILE
        Evaluate the given file, similar to the 'source' builtin.  Specify it
        multiple times to run multiple files.  If the errexit option is on
        (e.g. in YSH), then the shell stops when $? is non-zero after
        evaluating a file.

    --eval-pure FILE
        Like --eval, but disallow I/O (known as "pure mode").

    --location-str
        Use this string to display error messages.
        See 'help sourceCode' for an example.

    --location-start-line
        Use this line number offset to display error messages.

    --tool            Run a tool instead of the shell (cat-em|syntax-tree)
    -n                Parse the program but don't execute it.  Print the AST.
    --ast-format FMT  The format for the AST (text|text-abbrev)

Examples:

    ysh --eval one.ysh --eval two.ysh -c 'echo hi'  # Run 2 files first
    osh -n -c 'hello'                               # pretty-print the AST
    ysh --ast-format text -n -c 'hello'             # in unabridged format

Oils 0.28.0		https://oils.pub/

~~~ oils-usage ~~~

bin/oils-for-unix is an executable that contains OSH, YSH, and more.

Usage:
    oils-for-unix MAIN_NAME ARG*
    MAIN_NAME ARG*

It behaves like busybox.  The command name can be passed as the first argument:

    oils-for-unix ysh -c 'echo hi'

More commonly, it's invoked through a symlink like 'ysh', which causes it to
behave like that command:

    ysh -c 'echo hi'

~~~ shell-flags ~~~

osh and ysh accept standard POSIX shell flags, like:

    bin/osh -o errexit -c 'false'
    bin/ysh -n myfile.ysh
    bin/ysh +o errexit -c 'false; echo ok'

They also accept these flags:

    --eval FILE
        Evaluate the given file, similar to the 'source' builtin.  Specify it
        multiple times to run multiple files.  If the errexit option is on
        (e.g. in YSH), then the shell stops when $? is non-zero after
        evaluating a file.

    --eval-pure FILE
        Like --eval, but disallow I/O (known as "pure mode").

    --location-str
        Use this string to display error messages.
        See 'help sourceCode' for an example.

    --location-start-line
        Use this line number offset to display error messages.

    --tool            Run a tool instead of the shell (cat-em|syntax-tree)
    -n                Parse the program but don't execute it.  Print the AST.
    --ast-format FMT  The format for the AST (text|text-abbrev)

Examples:

    ysh --eval one.ysh --eval two.ysh -c 'echo hi'  # Run 2 files first
    osh -n -c 'hello'                               # pretty-print the AST
    ysh --ast-format text -n -c 'hello'             # in unabridged format

OK  test-help
*** Running test-noexec-fails-properly
  echo; echo; |
              ^
[ -c flag ]:1: Invalid word while parsing command
_tmp/osh-usage-noexec.txt appears empty, as expected
OK  test-noexec-fails-properly
*** Running test-osh-file
===== Hello
hi
inside func
in subshell
another
Traceback (most recent call last):
  File "/home/uke/oil/bin/oils_for_unix.py", line 202, in <module>
    sys.exit(main(sys.argv))
  File "/home/uke/oil/bin/oils_for_unix.py", line 171, in main
    return AppBundleMain(argv)
  File "/home/uke/oil/bin/oils_for_unix.py", line 141, in AppBundleMain
    return shell.Main('osh', arg_r, environ, login_shell, loader, readline)
  File "/home/uke/oil/core/shell.py", line 1253, in Main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/uke/oil/core/main_loop.py", line 336, in Batch
    was_parsed, status = Batch2(cmd_ev, c_parser, errfmt, cmd_flags=cmd_flags)
  File "/home/uke/oil/core/main_loop.py", line 401, in Batch2
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags)
  File "/home/uke/oil/osh/cmd_eval.py", line 2175, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/uke/oil/osh/cmd_eval.py", line 1974, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1701, in _Dispatch
    status = self._DoSimple(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 904, in _DoSimple
    allow_assign=True)
  File "/home/uke/oil/osh/word_eval.py", line 2541, in EvalWordSequence2
    self._EvalWordToParts(w, part_vals, EXTGLOB_FILES)
  File "/home/uke/oil/osh/word_eval.py", line 1989, in _EvalWordToParts
    self._EvalWordPart(p, word_part_vals, eval_flags)
  File "/home/uke/oil/osh/word_eval.py", line 1881, in _EvalWordPart
    quoted)  # type: part_value_t
  File "/home/uke/oil/osh/word_eval.py", line 2629, in _EvalCommandSub
    stdout_str = self.shell_ex.RunCommandSub(cs_part)
  File "/home/uke/oil/core/executor.py", line 692, in RunCommandSub
    status, stdout_str, stderr_str = self.CaptureStdout(node)
  File "/home/uke/oil/core/executor.py", line 620, in CaptureStdout
    fds, w, exc = select.select([r,r2], [], [r,r2], -1)
select.error: (22, 'Invalid argument')
FAIL  test-osh-file