aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorJim Porter2022-07-19 21:36:54 -0700
committerJim Porter2022-08-05 17:58:54 -0700
commit4e59830bc0ab17cdbd85748b133c97837bed99e3 (patch)
tree1fc29e2e33f71d60915c2f15e52a97dd416773ed /src/process.c
parentd7b89ea4077d4fe677ba0577245328819ee79cdc (diff)
downloademacs-4e59830bc0ab17cdbd85748b133c97837bed99e3.tar.gz
emacs-4e59830bc0ab17cdbd85748b133c97837bed99e3.zip
Add STREAM argument to 'process-tty-name'
* src/process.c (process-tty-name): Add STREAM argument. * lisp/eshell/esh-io.el (eshell-close-target): Only call 'process-send-eof' once if the process's stdin is a pipe. * test/src/process-tests.el (make-process/test-connection-type): Check behavior of 'process-tty-name'. * doc/lispref/processes.texi (Process Information): Document the new argument. * etc/NEWS: Announce this change.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/process.c b/src/process.c
index 68dbd8b68bd..23479c06194 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1243,14 +1243,31 @@ or t (process is stopped). */)
1243 return XPROCESS (process)->command; 1243 return XPROCESS (process)->command;
1244} 1244}
1245 1245
1246DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0, 1246DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 2, 0,
1247 doc: /* Return the name of the terminal PROCESS uses, or nil if none. 1247 doc: /* Return the name of the terminal PROCESS uses, or nil if none.
1248This is the terminal that the process itself reads and writes on, 1248This is the terminal that the process itself reads and writes on,
1249not the name of the pty that Emacs uses to talk with that terminal. */) 1249not the name of the pty that Emacs uses to talk with that terminal.
1250 (register Lisp_Object process) 1250
1251If STREAM is nil, return the terminal name if any of PROCESS's
1252standard streams use a terminal for communication. If STREAM is one
1253of `stdin', `stdout', or `stderr', return the name of the terminal
1254PROCESS uses for that stream specifically, or nil if that stream
1255communicates via a pipe. */)
1256 (register Lisp_Object process, Lisp_Object stream)
1251{ 1257{
1252 CHECK_PROCESS (process); 1258 CHECK_PROCESS (process);
1253 return XPROCESS (process)->tty_name; 1259 register struct Lisp_Process *p = XPROCESS (process);
1260
1261 if (NILP (stream))
1262 return p->tty_name;
1263 else if (EQ (stream, Qstdin))
1264 return p->pty_in ? p->tty_name : Qnil;
1265 else if (EQ (stream, Qstdout))
1266 return p->pty_out ? p->tty_name : Qnil;
1267 else if (EQ (stream, Qstderr))
1268 return p->pty_out && NILP (p->stderrproc) ? p->tty_name : Qnil;
1269 else
1270 signal_error ("Unknown stream", stream);
1254} 1271}
1255 1272
1256static void 1273static void