upterm icon indicating copy to clipboard operation
upterm copied to clipboard

`--force-command` does not inherit `UPTERM_ADMIN_SOCKET` environment variable

Open pstumpf-wizai opened this issue 5 months ago • 3 comments

When passing --force-command to upterm host (e.g. to invoke tmux), the environment variable UPTERM_ADMIN_SOCKET is not passed to the command. As a result, even with

set -ag update-environment UPTERM_ADMIN_SOCKET

in ~/.tmux.conf, as suggested by the README, upterm session current does not work inside tmux.

host/internal/server.go:startAttachCmd should probably be modified to take care of this.

pstumpf-wizai avatar Jul 16 '25 12:07 pstumpf-wizai

High, I just ran into the same problem. I was trying one of the examples from the README:

upterm host --force-command 'tmux attach -t pair-programming' -- tmux new -t pair-programming

This doesn't work:

  • Upterm launches tmux immediately, hiding the message with the session information.
  • You can't run upterm session current inside the tmux session because the environment variable isn't set
  • So: There's no way to provide your pair programming partner with the necessary connection information.

larsks avatar Jul 28 '25 15:07 larsks

I just verified that upterm session current works for me with tmux version 3.5a. I have the following in my ~/.tmux.conf:

set-option -ga update-environment " UPTERM_ADMIN_SOCKET"

Ref: https://github.com/owenthereal/upterm?tab=readme-ov-file#resolving-tmux-session-display-issue.

If upterm session current doesn't work for some reasons, you could always list all sessions with upterm session list and then upterm session info NAME to get the connection info.

owenthereal avatar Jul 29 '25 07:07 owenthereal

I think I need to be a bit clearer; this has nothing to do with tmux. tmux was just an example.

Steps to reproduce:

upterm host --force-command /bin/bash ...

[connect to the session via ssh]

$ echo $UPTERM_ADMIN_SOCKET

$ 

pstumpf-wizai avatar Jul 29 '25 08:07 pstumpf-wizai