windows - tmux 没有服务器在/tmp/tmux-*/default - Windows msys2 终端上运行

标签 windows terminal tmux msys2

我是 tmux 的新手,一直在尝试获得 .tmux.conf这适合我并构建一个脚本来设置 session 。在某些时候,我开始收到此错误

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

此消息仅在没有事件 session 并且我运行类似 tmux ls 的命令时出现。 .

我试过follow solutions like this one但我在 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>

如果您在 msys2 或 Git Bash 终端中知道与上述 Windows 8 等效的命令,我将不胜感激。

万一我的 .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 .

我希望这需要与 ps 等效的命令和 kill -SIGUSR1 [PID]在 Windows 8 上,在 msys2 或 Git Bash 终端中。

最佳答案

将 SIGUSR1 发送到 tmux 仅在 tmux 服务器已在运行但某些内容已从/tmp 中删除其套接字时才有用。你确定是这种情况吗?

如果没有 tmux 服务器在运行,您只需要使用“tmux new”启动一个新服务器。

关于windows - tmux 没有服务器在/tmp/tmux-*/default - Windows msys2 终端上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58410265/

相关文章:

C++:如何休眠一纳秒?

go - 如何读取带有颜色属性的命令输出?

scroll - 如何增加 tmux 中的回滚缓冲区大小?

bash - Tmux 提示不遵循正常的 bash 提示 PS1\W

c++ - 从 C++ 文件中读取和打印 UTF-8 符号

用于 git 的 Windows 图形用户界面

windows - 在 Windows 上将未提交的更改移动到另一个分支的 Perforce 方法

linux - bash while循环不退出也不回显

visual-studio-code - 使用 Visual Studio Code 进行调试并将终端输出管道传输到文件

bash - 使用 tmux 会丢失我所有的 bash 别名,我怎样才能让它们保留下来?