skywind3000 / z.lua

:zap: A new cd command that helps you navigate faster by learning your habits.
MIT License
2.94k stars 137 forks source link

lua进程不关闭 #197

Open lyonscott opened 6 months ago

lyonscott commented 6 months ago

我的环境是 win11 wsl2 ubuntu20.04.6LTS

eval "$(lua /path/to/z.lua --init bash)"

.bashrc的配置

但是每次我调用z之后,ps看进程就会多一个bash和lua,window进程看lua的cpu占用还挺高

skywind3000 commented 6 months ago

WSL1 请安装 lua-filesystem,文档看一下:

image

lyonscott commented 6 months ago

过程是这样的

lyon:~$ ps
  PID TTY          TIME CMD
  478 tty4     00:00:00 bash
  500 tty4     00:00:00 ps
lyon:~$ z /mnt/e
lyon:/mnt/e$ ps
  PID TTY          TIME CMD
  478 tty4     00:00:00 bash
  507 tty4     00:00:00 bash
  509 tty4     00:00:00 lua
  510 tty4     00:00:00 ps
lyon:/mnt/e$ z /mnt/f
lyon:/mnt/f$ ps
  PID TTY          TIME CMD
  478 tty4     00:00:00 bash
  507 tty4     00:00:00 bash
  509 tty4     00:00:03 lua
  512 tty4     00:00:00 bash
  514 tty4     00:00:02 lua
  518 tty4     00:00:00 bash
  520 tty4     00:00:00 lua
  521 tty4     00:00:00 ps
lyon:/mnt/f$ ps
  PID TTY          TIME CMD
  478 tty4     00:00:00 bash
  507 tty4     00:00:00 bash
  509 tty4     00:00:04 lua
  512 tty4     00:00:00 bash
  514 tty4     00:00:03 lua
  518 tty4     00:00:00 bash
  520 tty4     00:00:01 lua
  523 tty4     00:00:00 bash
  525 tty4     00:00:00 lua
  526 tty4     00:00:00 ps
lyon:/mnt/f$ cat ~/.bashrc | tail -n 5
# fast cd
eval "$(/usr/local/bin/lua ~/.config/z.lua/z.lua --init bash)"

LS_COLORS='di=0:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43'
export LS_COLORS
lyon:/mnt/f$ sudo apt-get install lua-filesystem
[sudo] password for lyon:
Reading package lists... Done
Building dependency tree
Reading state information... Done
lua-filesystem is already the newest version (1.7.0-2-1).
The following packages were automatically installed and are no longer required:
  libluajit-5.1-2 libluajit-5.1-common libmsgpackc2 libtermkey1 libunibilium4 libvterm0 lua-luv python3-greenlet python3-msgpack
  python3-neovim python3-pynvim xclip
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 204 not upgraded.
skywind3000 commented 6 months ago

装了 lua-filesystem 以后把其他 lua 进程杀了就 OK 了。

lyonscott commented 6 months ago

大大我麻了。。最近感觉卡然后看进程才发现的

lyon:~$ sudo apt-get install lua-filesystem
[sudo] password for lyon:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  lua-filesystem
0 upgraded, 1 newly installed, 0 to remove and 203 not upgraded.
Need to get 0 B/11.4 kB of archives.
After this operation, 95.2 kB of additional disk space will be used.
Selecting previously unselected package lua-filesystem:amd64.
(Reading database ... 64558 files and directories currently installed.)
Preparing to unpack .../lua-filesystem_1.7.0-2-1_amd64.deb ...
Unpacking lua-filesystem:amd64 (1.7.0-2-1) ...
Setting up lua-filesystem:amd64 (1.7.0-2-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
lyon:~$ cat ~/.bashrc | tail -n 5
# fast cd
# eval "$(lua ~/.config/z.lua/z.lua --init bash)"

LS_COLORS='di=0:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43'
export LS_COLORS
lyon:~$ nvim ~/.bashrc
lyon:~$ cat ~/.bashrc | tail -n 5
# fast cd
eval "$(lua ~/.config/z.lua/z.lua --init bash)"

LS_COLORS='di=0:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43'
export LS_COLORS
lyon:~$ source ~/.bashrc
lyon:~$ ps
  PID TTY          TIME CMD
  264 tty1     00:00:00 bash
  469 tty1     00:00:00 ps
lyon:~$ z /mnt/f/
lyon:/mnt/f$ ps
  PID TTY          TIME CMD
  264 tty1     00:00:00 bash
  478 tty1     00:00:00 bash
  480 tty1     00:00:01 lua
  481 tty1     00:00:00 ps
lyon:/mnt/f$ ps
  PID TTY          TIME CMD
  264 tty1     00:00:00 bash
  478 tty1     00:00:00 bash
  480 tty1     00:00:03 lua
  483 tty1     00:00:00 bash
  485 tty1     00:00:02 lua
  486 tty1     00:00:00 ps
lyon:/mnt/f$ ps
  PID TTY          TIME CMD
  264 tty1     00:00:00 bash
  478 tty1     00:00:00 bash
  480 tty1     00:00:04 lua
  483 tty1     00:00:00 bash
  485 tty1     00:00:03 lua
  488 tty1     00:00:00 bash
  490 tty1     00:00:00 lua
  491 tty1     00:00:00 ps