将Node.js Grunt作业发送到后台

问题描述 投票:0回答:1

通常在终端的命令末尾附加&将隐藏输出/重定向命令的标准输出。

我知道我可以启动一个tmux会话来实现相同的目标(即,隐藏输出,并使用相同的终端窗口执行更多命令),但我很好奇为什么webpack的服务器似乎会将作业发送到后台,然后在几秒钟后不再这样做。

webpack dev server output

我看过man bash并发现了这个问题,但仍然不能完全回答我的问题(我使用重定向操作符的其他脚本都没有这样的行为)

Redirecting Standard Output and Standard Error

       Bash allows both the standard output (file descriptor 1) and the standard error output  (file
       descriptor 2) to be redirected to the file whose name is the expansion of word with this con-
       struct.

       There are two formats for redirecting standard output and standard error:

              &>word
       and
              >&word

       Of the two forms, the first is preferred.  This is semantically equivalent to

              >word 2>&1

node.js bash terminal output jobs
1个回答
0
投票

尝试一下:

nohup grunt serve &

推荐阅读:Difference between nohup, disown and &

© www.soinside.com 2019 - 2024. All rights reserved.