tmux在Windows msys2终端中报错:/tmp/tmux-*/default没有运行服务器。

18

我是tmux的新手,一直在尝试寻找适合我的.tmux.conf并编写一个脚本来设置会话。但是某些时候我会遇到这个错误:

no server running on /tmp/tmux-1065767/default

当没有活动会话时,我运行像tmux ls这样的命令时,才会出现此消息。


我尝试过像这个解决方案一样的方法,但我在Windows 8机器上,*nix命令无法工作,我也找不到等效的命令。从该链接中相关的部分是使用ps获取PID,并使用kill -SIGUSR1/tmp/tmux-*/default上启动服务器:

% ps aux | grep -w [t]mux
root     14799  0.2  0.0  36020   488 ?        Ss   May08  51:30 tmux
% kill -USR1 14799
% tmux ls
<list of tmux sessions>

如果你知道在Windows 8中,在msys2或Git Bash终端中有相应的命令,我将不胜感激。
如果我的.tmux.conf或设置脚本有问题,我已经在下面附上了它们。
配置文件:
# allow names to stick
set-option -g allow-rename off

# use the lovely fish
set-option -g default-shell /usr/bin/fish
set -g default-command /usr/bin/fish

# modify the status bar
set -g status-bg colour233
set -g status-fg colour40
set-option -g status-position top

# new prefix
unbind C-b
set-option -g prefix C-Space

# don't punish slow release of control when moving windows
bind C-n next-window
bind C-p previous-window

# alt close windows
bind X confirm kill-window

# split panes using v and s
bind v split-window -h
bind s split-window -v
unbind '"'
unbind %

# reload config file
bind r source-file ~/.tmux.conf

# hopefully help tmux believe in colourful vim
set -g default-terminal "xterm-256color"

# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# clear pane title
bind ] select-pane -T ''

安装脚本:

#! /bin/bash
# For setting up BrokenFlows' default tmux work space

# for checking if the session exists
desired="dfws"
existing=`tmux ls | grep -o $desired`

if [ "$existing" == "$desired" ] # don't wind up if it's already there
then
    tmux attach-session -t $desired
else
    # if it wasn't there then setup as below

    tmux new-session -s $desired -d # name "DeFault WorkSpace" and detach
# called from cli but affecting most recent session:
    tmux rename-window "home" 

    # split window 0
    tmux split-window -v -p 38 # set bottom to 38% height
    tmux split-window -h -p 60 # set right to 60% width
    tmux split-window -h -p 51 # set right to 51% width

    # setup commands in window 0
    tmux clock-mode -t 0.1 # time in the bottom left pane
    tmux send-keys -t 0.2 'cpu' Enter # % cpu in bottom middle pane
    tmux send-keys -t 0.3 'mem' Enter # MByte mem in bottom right pane

    # open to-do list in window 1
    tmux new-window -n "vim" 
    tmux send-keys -t "vim" 'vim ~/Desktop/Today.taskpaper' Enter

    # go to home window and pane
    tmux select-window -t 0
    tmux select-pane -t 0

    # name panes in window 0
    sleep 2
    tmux set pane-border-status top
    tmux set pane-border-format "#T"
    tmux select-pane -t 0 -T ""
    tmux select-pane -t 0 -T ''
    tmux select-pane -t 1 -T 'Time'
    tmux select-pane -t 2 -T '% CPU'
    tmux select-pane -t 3 -T 'MByte Memory'

    # attach to session now it is set up
    tmux attach-session -d
fi


我希望能够恢复默认行为,即当“没有运行的服务器”输出被正确响应时,可以使用命令tmux ls

我想这需要在Windows 8的msys2或Git Bash终端中执行等效于pskill -SIGUSR1 [PID]的命令。

2个回答

13

只有在tmux服务器已经运行但是某个东西从/tmp中删除了其套接字时,向tmux发送SIGUSR1才有用。您确定是这种情况吗?

如果没有运行tmux服务器,则只需使用"tmux new"命令启动一个新的服务器。


当没有会话运行时,我尝试执行 tmux ls 等操作时会收到错误消息,但之前我应该会看到标准输出表明没有会话。 - BitFlow
2
当tmux服务器未运行并且一直处于这种状态时,您将从"tmux ls"收到此消息。您是否在考虑使用"tmux attach"?如果服务器未运行,它将响应"no sessions"(因为它会尝试启动服务器以防您在.tmux.conf中创建会话)。 - Nicholas Marriott
2
抱歉将两者混淆了。您是正确的,我记错了 tmux attach 的输出属于 tmux ls。感谢您为我澄清这一点。 - BitFlow

0
清除~/.tmux.config,如果你也在tmux中启动tmux。

你的回答可以通过提供更多的支持性信息来改进。请编辑以添加进一步的细节,例如引用或文档,以便他人可以确认你的回答是否正确。你可以在帮助中心找到更多关于如何撰写好回答的信息。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接