• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
      • Io
      • Defttag
      • Sys-call
      • Save-exec
      • Quicklisp
      • Oslib
      • Std/io
      • Bridge
      • Clex
      • Tshell
        • Tshell-call
          • Tshell-ensure
          • Tshell-start
          • Tshell-run-background
          • Tshell-call-fn1
        • Unsound-eval
        • Hacker
        • Startup-banner
        • Command-line
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Tshell

    Tshell-call

    Use tshell to run a sub-program and wait for it to finish. (never forks ACL2).

    Signature
    (tshell-call cmd &key (print 't) (save 't)) 
      → 
    (mv exit-status lines)
    Arguments
    cmd — This is the command to run. It can actually be a full-blown shell script. It should not require any input from the user.
        Guard (stringp cmd).
    print — This says whether we should print the lines produced by cmd as they are produced. nil means print nothing, t means print everything, and any other symbol fn means call the raw Lisp function fn to do the printing. Custom output functions are an advanced feature; see tshell-raw.lsp for details.
        Guard (symbolp print).
    save — This says whether we should capture the stdout/stderr lines produced by cmd and return them as the lines output. If you aren't going to analyze the program's output, you might want to set this to nil to cut down on memory usage.
        Guard (booleanp save).
    Returns
    exit-status — The exit code from the command. Typically 0 means success and any non-zero value means failure. This is only sensible if finishedp is t.
        Type (natp exit-status).
    lines — The output from the command (from both standard output and standard error.) Note that lines will always just be nil if you're using :save nil.
        Type (string-listp lines).

    Before using tshell-call you need to make sure that the bash processes for tshell have been started; see tshell-start and tshell-ensure.

    Note that :save and :print are independent from one-another; you can print without saving, save without printing, save and print, or do neither and just get the exit code.

    Definitions and Theorems

    Function: tshell-call-fn

    (defun
     tshell-call-fn (cmd print save)
     (declare (xargs :guard (and (stringp cmd)
                                 (symbolp print)
                                 (booleanp save))))
     (let
      ((__function__ 'tshell-call))
      (declare (ignorable __function__))
      (progn$
          (cw "Warning: under-the-hood definition of ~s0 not installed?"
              __function__)
          (tshell-call-fn1 cmd print save))))

    Theorem: natp-of-tshell-call.exit-status

    (defthm natp-of-tshell-call.exit-status
            (b* (((mv ?exit-status ?lines)
                  (tshell-call-fn cmd print save)))
                (natp exit-status))
            :rule-classes :type-prescription)

    Theorem: string-listp-of-tshell-call.lines

    (defthm string-listp-of-tshell-call.lines
            (b* (((mv ?exit-status ?lines)
                  (tshell-call-fn cmd print save)))
                (string-listp lines))
            :rule-classes :rewrite)