Next: , Previous: , Up: Processes   [Contents][Index]


57.6 Sending Input to Processes

Asynchronous subprocesses receive input when it is sent to them by SXEmacs, which is done with the functions in this section. You must specify the process to send input to, and the input data to send. The data appears on the “standard input” of the subprocess.

Some operating systems have limited space for buffered input in a PTY. On these systems, SXEmacs sends long input in chunks, with EOF characters added amidst the other characters, to force the operating system to periodically drain the input buffer. For most programs, these EOFs do no harm.

Function: process-send-string process string &optional start end

This function sends process the contents of string as standard input.

The argument process may be a process or the name of a process, or a buffer or the name of a buffer, in which case the buffer’s process is used. If it is nil, the current buffer’s process is used.

Optional arguments start and end specify part of string; see substring.

The function returns nil.

(process-send-string "shell<1>" "ls\n")
     ⇒ nil

---------- Buffer: *shell* ----------
...
introduction.texi               syntax-tables.texi~
introduction.texi~              text.texi
introduction.txt                text.texi~
...
---------- Buffer: *shell* ----------
Function: process-send-region process start end &optional buffer

This function sends the text in the region defined by start and end as standard input to process.

The argument process may be a process or the name of a process, or a buffer or the name of a buffer, in which case the buffer’s process is used. If it is nil, the current buffer’s process is used.

An error is signaled unless both start and end are integers or markers that indicate positions in the current buffer. (It is unimportant which number is larger.)

Function: process-send-eof &optional process

This function makes process see an end-of-file in its input. The EOF comes after any text already sent to it.

process may be a process, a buffer, the name of a process or buffer, or nil, indicating the current buffer’s process. An error is signaled if process does not identify any process.

The function returns the process object identified by process.

(process-send-eof "shell")
     ⇒ "shell"

Next: , Previous: , Up: Processes   [Contents][Index]