This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch tymux
in repository terminology.

View the commit online.

commit d2499222ccfd185c199fd9fec871cc02ed387ce9
Author: [email protected] <[email protected]>
AuthorDate: Mon May 4 21:30:33 2026 -0600

    feat(tymux): send CWD before honoring client DETACH in daemon
    
    In the daemon's per-client read handler, the TSRV_MSG_DETACH case now
    readlinks /proc/<inner-shell-pid>/cwd and ships the path to the
    disconnecting client via TSRV_MSG_CWD before closing the fd. On any
    readlink failure, the daemon sends zero-length CWD payload (protocol
    sentinel for "no cwd available"). Native Terminology clients use this
    to spawn fresh shells at the same working directory after detach,
    preserving the user's filesystem location. The readlink executes while
    the inner shell is still alive, so /proc lookup is reliable.
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
---
 src/bin/termd_tymux.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/bin/termd_tymux.c b/src/bin/termd_tymux.c
index f0c06ea6..612eef11 100644
--- a/src/bin/termd_tymux.c
+++ b/src/bin/termd_tymux.c
@@ -1,6 +1,7 @@
 #include "private.h"
 
 #include <errno.h>
+#include <limits.h>
 #include <stdatomic.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -552,6 +553,18 @@ _cb_client_data(void *data, Ecore_Fd_Handler *fd_handler EINA_UNUSED)
          break;
 
       case TSRV_MSG_DETACH:
+         {
+            char proc_path[64], cwd_buf[PATH_MAX];
+            ssize_t n = -1;
+            if (sess->pty && sess->pty->pid > 0)
+              {
+                 snprintf(proc_path, sizeof(proc_path),
+                          "/proc/%d/cwd", (int)sess->pty->pid);
+                 n = readlink(proc_path, cwd_buf, sizeof(cwd_buf));
+              }
+            if (n < 0) n = 0;
+            termsrv_send_cwd(client->fd, cwd_buf, (uint32_t)n);
+         }
          free(payload);
          _client_remove(sess, client);
          return ECORE_CALLBACK_CANCEL;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to