如何在 Procfile 中过滤(grep)进程的输出?

How to filter (grep) output of a process in Procfile?

我有一个看起来像这样的 Procfile:

electron: ./node_modules/.bin/electron .

我想从输出中删除所有带有 _rawLocationToUILocation 的行。我试过以下方法:

electron: sh -c './node_modules/.bin/electron . 2>&1 | grep -v rawLocationToUILocation'

但在那之后,所有输出都被删除了。我认为它可能与缓冲有关,所以我使用了 unbuffer 但这并没有改变任何东西。

有什么想法吗?

自己找到了答案。确实跟缓冲有关

使用 grep 的 --line-buffered 选项解决了问题。