【问题标题】:Sending a Node.js Grunt job to background将 Node.js Grunt 作业发送到后台
【发布时间】:2020-02-25 04:10:20
【问题描述】:

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

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

我查看了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】:

    试试这个:

    nohup grunt serve &
    

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

    【讨论】:

      猜你喜欢
      • 2012-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多