From: Eli Zaretskii <eliz@gnu.org>
To: Jim Porter <jporterbugs@gmail.com>
Cc: larsi@gnus.org, 56025@debbugs.gnu.org,
spwhitton@email.arizona.edu, kbrown@cornell.edu
Subject: bug#56025: [PATCH v4] 29.0.50; em-extpipe-test-2 times out on EMBA and Cygwin
Date: Sun, 24 Jul 2022 12:47:36 +0300 [thread overview]
Message-ID: <834jz6hmfb.fsf@gnu.org> (raw)
In-Reply-To: <7056ea9f-a55d-28b7-52cf-caca7a9053a5@gmail.com> (message from Jim Porter on Sat, 23 Jul 2022 22:29:28 -0700)
> From: Jim Porter <jporterbugs@gmail.com>
> Cc: larsi@gnus.org, 56025@debbugs.gnu.org
> Date: Sat, 23 Jul 2022 22:29:28 -0700
>
> -@defun process-tty-name process
> +@defun process-tty-name process &optional stream
> This function returns the terminal name that @var{process} is using for
> its communication with Emacs---or @code{nil} if it is using pipes
> instead of a pty (see @code{process-connection-type} in
> -@ref{Asynchronous Processes}). If @var{process} represents a program
> -running on a remote host, the terminal name used by that program on
> -the remote host is provided as process property @code{remote-tty}. If
> -@var{process} represents a network, serial, or pipe connection, the
> -value is @code{nil}.
> +@ref{Asynchronous Processes}). If @var{stream} is one of @code{stdin},
> +@code{stdout}, or @code{stderr}, this function returns the terminal
> +name (or @code{nil}, as above) that @var{process} uses for that stream
> +specifically. You can use this to determine whether a particular
> +stream uses a pipe or a pty.
This text doesn't tell what happens if STREAM is nil or omitted.
> +If @var{process} represents a program running on a remote host, the
> +terminal name used by that program on the remote host is provided as
> +process property @code{remote-tty}. If @var{process} represents a
> +network, serial, or pipe connection, the value is @code{nil}.
If the previous paragraph is only for local subprocesses, the text
there should say so.
> @end defun
>
> @defun process-coding-system process
> diff --git a/etc/NEWS b/etc/NEWS
> index dc79f0826a..23777d349e 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -3198,7 +3198,10 @@ invocation. Such shells are POSIX conformant by default.
> ** 'make-process' can set connection type independently for input and output.
> When calling 'make-process', communication via pty can be enabled
> selectively for just input or output by passing a cons cell for
> -':connection-type', e.g. '(pipe . pty)'.
> +':connection-type', e.g. '(pipe . pty)'. When examining a process
> +later, you can determine whether a particular stream for a process
> +uses a pty by passing one of 'stdin', 'stdout', or 'stderr' as the
> +second argument to 'process-tty-name'.
>
> +++
> ** 'signal-process' now consults the list 'signal-process-functions'.
> diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
> index c035890ddf..68e52a2c9c 100644
> --- a/lisp/eshell/esh-io.el
> +++ b/lisp/eshell/esh-io.el
> @@ -276,18 +276,21 @@ eshell-close-target
> ;; If we're redirecting to a process (via a pipe, or process
> ;; redirection), send it EOF so that it knows we're finished.
> ((eshell-processp target)
> - ;; According to POSIX.1-2017, section 11.1.9, sending EOF causes
> - ;; all bytes waiting to be read to be sent to the process
> - ;; immediately. Thus, if there are any bytes waiting, we need to
> - ;; send EOF twice: once to flush the buffer, and a second time to
> - ;; cause the next read() to return a size of 0, indicating
> - ;; end-of-file to the reading process. However, some platforms
> - ;; (e.g. Solaris) actually require sending a *third* EOF. Since
> - ;; sending extra EOFs while the process is running shouldn't break
> - ;; anything, we'll just send the maximum we'd ever need. See
> - ;; bug#56025 for further details.
> - (let ((i 0))
> - (while (and (<= (cl-incf i) 3)
> + ;; According to POSIX.1-2017, section 11.1.9, when communicating
> + ;; via terminal, sending EOF causes all bytes waiting to be read
> + ;; to be sent to the process immediately. Thus, if there are any
> + ;; bytes waiting, we need to send EOF twice: once to flush the
> + ;; buffer, and a second time to cause the next read() to return a
> + ;; size of 0, indicating end-of-file to the reading process.
> + ;; However, some platforms (e.g. Solaris) actually require sending
> + ;; a *third* EOF. Since sending extra EOFs while the process is
> + ;; running are a no-op, we'll just send the maximum we'd ever
> + ;; need. See bug#56025 for further details.
> + (let ((i 0)
> + ;; Only call `process-send-eof' once if communicating via a
> + ;; pipe (in truth, this just closes the pipe).
> + (max-attempts (if (process-tty-name target 'stdin) 3 1)))
> + (while (and (<= (cl-incf i) max-attempts)
> (eq (process-status target) 'run))
> (process-send-eof target))))
>
> diff --git a/src/process.c b/src/process.c
> index da5e9cb182..adc508156f 100644
> --- a/src/process.c
> +++ b/src/process.c
> @@ -1243,14 +1243,29 @@ DEFUN ("process-command", Fprocess_command, Sprocess_command, 1, 1, 0,
> return XPROCESS (process)->command;
> }
>
> -DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 1, 0,
> +DEFUN ("process-tty-name", Fprocess_tty_name, Sprocess_tty_name, 1, 2, 0,
> doc: /* Return the name of the terminal PROCESS uses, or nil if none.
> This is the terminal that the process itself reads and writes on,
> -not the name of the pty that Emacs uses to talk with that terminal. */)
> - (register Lisp_Object process)
> +not the name of the pty that Emacs uses to talk with that terminal.
> +
> +If STREAM is one of `stdin', `stdout', or `stderr', return the name of
> +the terminal PROCESS uses for that stream. This can be used to detect
> +whether a particular stream is connected via a pipe or a pty. */)
> + (register Lisp_Object process, Lisp_Object stream)
Same here: the call without the optional argument returns something
whose relation to the value when STREAM is non-nil is not clear from
the doc string.
Thanks.
next prev parent reply other threads:[~2022-07-24 9:47 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 18:30 bug#56025: 29.0.50; em-extpipe-test-2 times out on EMBA and Cygwin Ken Brown
2022-06-16 19:30 ` Sean Whitton
2022-06-16 22:01 ` Ken Brown
2022-06-17 13:39 ` Ken Brown
2022-06-18 0:57 ` Sean Whitton
2022-06-18 2:07 ` Ken Brown
2022-06-18 2:35 ` Ken Brown
2022-06-18 3:50 ` Jim Porter
2022-06-18 17:52 ` Ken Brown
2022-06-18 19:02 ` Jim Porter
2022-06-18 20:51 ` Ken Brown
2022-06-18 22:00 ` Jim Porter
2022-06-18 23:46 ` Sean Whitton
2022-06-19 16:02 ` Ken Brown
2022-06-24 1:18 ` Ken Brown
2022-06-24 4:40 ` Sean Whitton
2022-06-24 6:07 ` Eli Zaretskii
2022-06-24 16:53 ` Jim Porter
2022-06-24 22:23 ` Sean Whitton
2022-06-24 23:03 ` Jim Porter
2022-06-25 5:34 ` Eli Zaretskii
2022-06-25 16:13 ` Jim Porter
2022-06-25 16:53 ` Eli Zaretskii
2022-06-26 16:27 ` Lars Ingebrigtsen
2022-06-26 17:12 ` Sean Whitton
2022-06-26 17:22 ` Jim Porter
2022-06-26 21:11 ` Sean Whitton
2022-06-27 13:25 ` Ken Brown
2022-06-27 15:51 ` Michael Albinus
2022-06-27 16:22 ` Ken Brown
2022-06-27 19:13 ` bug#56025: [EXT]Re: " Sean Whitton
2022-06-27 21:17 ` Ken Brown
2022-06-27 19:18 ` Jim Porter
2022-06-27 21:19 ` Ken Brown
2022-07-01 3:52 ` Jim Porter
2022-07-01 3:58 ` Jim Porter
2022-07-06 22:33 ` Ken Brown
2022-07-07 4:35 ` Jim Porter
2022-07-07 4:42 ` Jim Porter
2022-07-07 12:42 ` Ken Brown
2022-07-17 2:35 ` bug#56025: [WIP PATCH] " Jim Porter
2022-07-17 6:03 ` Eli Zaretskii
2022-07-17 17:44 ` Jim Porter
2022-07-17 18:26 ` Eli Zaretskii
2022-07-17 18:51 ` Jim Porter
2022-07-18 8:09 ` Michael Albinus
2022-07-19 1:58 ` Jim Porter
2022-07-19 7:59 ` Michael Albinus
2022-07-17 21:59 ` Ken Brown
2022-07-18 5:26 ` Jim Porter
2022-07-22 4:16 ` bug#56025: [PATCH v2] " Jim Porter
2022-07-22 19:00 ` Ken Brown
2022-07-24 4:05 ` Jim Porter
2022-07-24 5:19 ` bug#56025: [PATCH v3] " Jim Porter
2022-07-24 5:29 ` bug#56025: [PATCH v4] " Jim Porter
2022-07-24 9:08 ` Lars Ingebrigtsen
2022-07-24 9:48 ` Eli Zaretskii
2022-07-24 21:04 ` Ken Brown
2022-07-24 9:47 ` Eli Zaretskii [this message]
2022-07-24 17:36 ` bug#56025: [PATCH v5] " Jim Porter
2022-07-24 20:30 ` Ken Brown
2022-07-31 1:01 ` Jim Porter
2022-08-06 1:10 ` Jim Porter
2022-08-06 12:17 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=834jz6hmfb.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=56025@debbugs.gnu.org \
--cc=jporterbugs@gmail.com \
--cc=kbrown@cornell.edu \
--cc=larsi@gnus.org \
--cc=spwhitton@email.arizona.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).