All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

shell-pane Class

Summary

A pane allowing the user to interact with a subprocess.

Package

capi

Superclasses

interactive-pane

Initargs
:command
The command which is run as a subprocess.
Accessors

shell-pane-command

Description

The class shell-pane creates an editor in which a subprocess runs.

User input is interpreted as input to the subprocess. In particular, when the user enters Return in the last line, the line is sent to the subprocess. The output of the subprocess is displayed in the pane.

The default value of command is nil, which means that the actual command is determined as follows:

On Microsoft Windows, cmd.exe is run.

On non-Windows platforms, the value of the environment variable ESHELL is used if set, and otherwise the environment variable SHELL is consulted. If that is not set, then /bin/csh (/bin/sh on SVR4 platforms) is run.

Examples

This function emulates user input on pane:

(defun send-keys-to-pane-aux (pane string newline-p)
  (loop for char across string
        do (capi:call-editor pane char))
  (if newline-p
      (capi:call-editor pane #\Return)))

This function trampolines to send-keys-to-pane-aux on the right process:

(defun send-keys-to-pane (pane string newline-p)
  (capi:apply-in-pane-process pane 
                              'send-keys-to-pane-aux
                              pane string newline-p))
 
(setq sp (capi:contain 
          (make-instance 'capi:shell-pane
                         :visible-min-width 
                         '(character 60)
                         :visible-min-height
                         '(character 30))))

This call emulates the user typing dir followed by Return:

(send-keys-to-pane sp "dir" t)

CAPI User Guide and Reference Manual (Windows version) - 01 Dec 2021 19:33:57