1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: Operating System utilities
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Jul 2003
12 ;;;; *************************************************************************
16 (defun command-output (control-string &rest args)
17 "Interpolate ARGS into CONTROL-STRING as if by FORMAT, and
18 synchronously execute the result using a Bourne-compatible shell,
19 returns (VALUES string-output error-output exit-status)"
20 (let ((command (apply #'format nil control-string args)))
22 (sb-impl::process-exit-code
26 :input nil :output nil))
29 (ext:process-exit-code
33 :input nil :output nil))
37 (multiple-value-bind (output error status)
38 (excl.osi:command-output command)
39 (values output error status))
42 (system:call-system-showing-output
45 :output-stream output)
47 #+clisp ;XXX not exactly *verbose-out*, I know
48 (ext:run-shell-command command :output :terminal :wait t)
52 (ccl:external-process-status
53 (ccl:run-program "/bin/sh" (list "-c" command)
54 :input nil :output nil
57 #-(or openmcl clisp lispworks allegro scl cmu sbcl)
58 (error "RUN-SHELL-PROGRAM not implemented for this Lisp")
62 (defun run-shell-command (control-string &rest args)
63 "Interpolate ARGS into CONTROL-STRING as if by FORMAT, and
64 synchronously execute the result using a Bourne-compatible shell,
65 returns (VALUES output-string pid)"
66 (let ((command (apply #'format nil control-string args)))
68 (sb-impl::process-exit-code
72 :input nil :output nil))
75 (ext:process-exit-code
79 :input nil :output nil))
83 (multiple-value-bind (output dummy pid)
84 (excl:run-shell-command command :input nil :output :stream
86 (declare (ignore dummy))
90 (system:call-system-showing-output
93 :output-stream output)
95 #+clisp ;XXX not exactly *verbose-out*, I know
96 (ext:run-shell-command command :output :terminal :wait t)
100 (ccl:external-process-status
101 (ccl:run-program "/bin/sh" (list "-c" command)
102 :input nil :output nil
105 #-(or openmcl clisp lispworks allegro scl cmu sbcl)
106 (error "RUN-SHELL-PROGRAM not implemented for this Lisp")