1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: UFFI -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: Operating system interface for UFFI
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Sep 2002
10 ;;;; $Id: os.lisp,v 1.2 2002/10/14 03:07:41 kevin Exp $
12 ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg.
13 ;;;; Much of this code was taken from other open source project and copyright
14 ;;;; for that code is noted below where appropriate.
16 ;;;; UFFI users are granted the rights to distribute and use this software
17 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
18 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
19 ;;;; *************************************************************************
21 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
25 ;; Take from ASDF -- Copyright Dan Barlow and Contributors
27 (defun run-shell-command (control-string &rest args)
28 "Interpolate ARGS into CONTROL-STRING as if by FORMAT, and
29 synchronously execute the result using a Bourne-compatible shell, with
30 output to *trace-output*. Returns the shell's exit code."
31 (let ((command (apply #'format nil control-string args)))
32 (format *trace-output* "; $ ~A~%" command)
34 (sb-impl::process-exit-code
38 :input nil :output *trace-output*))
41 (ext:process-exit-code
45 :input nil :output *trace-output*))
48 (excl:run-shell-command command :input nil :output *trace-output*)
51 (system:call-system-showing-output
54 :output-stream *trace-output*)
56 #+clisp ;XXX not exactly *trace-output*, I know
57 (ext:run-shell-command command :output :terminal :wait t)
61 (ccl:external-process-status
62 (ccl:run-program "/bin/sh" (list "-c" command)
63 :input nil :output *trace-output*
66 #-(or openmcl clisp lispworks allegro scl cmu sbcl)
67 (error "RUN-SHELL-PROGRAM not implemented for this Lisp")