2

I want to use nodemon, but still have the use of my terminal, so I ran

$ nodemon &> site.log &

But as soon as I type a single character at the prompt, nodemon stops with this message.

[1]  + 45260 suspended (tty input)  nodemon &> site.log

What's going on? How can I make this stop happening?

I'm running zsh on MacOS.

EDIT: I found this answer which explains it perfectly - apparently nodemon tries to read from stdin, and unix systems will stop processes that try to read from stdin while in the background. So my question now becomes:

How do I get nodemon to stop reading from stdin? And, more generally, is there a way to get an arbitrary process to stop reading from stdin?

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Michael Dorst
  • 8,210
  • 11
  • 44
  • 71

1 Answers1

2

I figured it out. I have to redirect /dev/null to the input.

$ nodemon < /dev/null &> site.log &
Michael Dorst
  • 8,210
  • 11
  • 44
  • 71