diff options
Diffstat (limited to 'src/process.c')
-rw-r--r-- | src/process.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/process.c b/src/process.c index 372277a953d..a95192d8fba 100644 --- a/src/process.c +++ b/src/process.c @@ -1456,7 +1456,7 @@ DEFUN ("process-query-on-exit-flag", } DEFUN ("process-contact", Fprocess_contact, Sprocess_contact, - 1, 2, 0, + 1, 3, 0, doc: /* Return the contact info of PROCESS; t for a real child. For a network or serial or pipe connection, the value depends on the optional KEY arg. If KEY is nil, value is a cons cell of the form @@ -1465,9 +1465,12 @@ connection; it is t for a pipe connection. If KEY is t, the complete contact information for the connection is returned, else the specific value for the keyword KEY is returned. See `make-network-process', `make-serial-process', or `make-pipe-process' for the list of keywords. + If PROCESS is a non-blocking network process that hasn't been fully -set up yet, this function will block until socket setup has completed. */) - (Lisp_Object process, Lisp_Object key) +set up yet, this function will block until socket setup has completed. +If the optional NO-BLOCK parameter is specified, return nil instead of +waiting for the process to be fully set up.*/) + (Lisp_Object process, Lisp_Object key, Lisp_Object no_block) { Lisp_Object contact; @@ -1476,8 +1479,15 @@ set up yet, this function will block until socket setup has completed. */) #ifdef DATAGRAM_SOCKETS - if (NETCONN_P (process)) - wait_for_socket_fds (process, "process-contact"); + if (NETCONN_P (process) && XPROCESS (process)->infd < 0) + { + /* Usually wait for the network process to finish being set + * up. */ + if (!NILP (no_block)) + return Qnil; + + wait_for_socket_fds (process, "process-contact"); + } if (DATAGRAM_CONN_P (process) && (EQ (key, Qt) || EQ (key, QCremote))) |