运行 lein repl : 无头在后台

Running lein repl :headless in the background

目标:运行 lein 后台无头

我正在尝试 运行 一个无头的 leiningen REPL,而不是为它投入一个终端。也就是说,我想做

$ lein repl :headless &

但是几秒钟后bash报告它已经停止

$ [2]+  Stopped                 lein repl :headless

运行在 zsh 和 sh 中执行此操作具有相同的结果。这些 shell 会打印接收到的信号 SIGTTIN,这意味着该进程尝试从 STDIN 读取数据,尽管它不是终端控制进程。

以下作品:

$ bash -c "lein repl :headless &"
$ lein repl :headless </dev/null &

我查看了 repl :headless does not work without stdin,但无法使用那里的内容解决我的问题。


其他一些细节:

#!/bin/bash
lein repl :headless & 

到脚本 test.bash 和 运行ning ./test.bash 也可以。但是将行更改为 lein repl :headless 和 运行ning ./test.bash & 不会。

运行宁

$ lein repl :headless &
$ disown %1

也不行; ps 个进程报告它已终止。

我通常也会 运行 tmuxreattach-to-user-namespace,但我已经在 tmux 的内部和外部以及多个终端仿真器(iTerm2 和 Terminal)中尝试过这个.如果有帮助,here are my stty -a settings

lein trampoline repl :headless & 将解决此问题。

您可以阅读 this 以获得解释。