-
Notifications
You must be signed in to change notification settings - Fork 381
Description
On Linux, following the instructions in the quick start with Stack 3.3.1 and invoking the development server with stack exec -- yesod devel, the server performs an initial build but fails to respond to help or other commands and does not rebuild when files are changed or when you attempt to force a rebuild with an empty input line. The output of ps jx shows that the stack build --file-watch subprocess has been placed in a stopped state (process state code T=stopped by job control signal), similar to a process backgrounded by a shell that is waiting on input.
The culprit appears to be commit b3ed4613. This places the subprocess in its own process group, which no longer matches the foreground process group for the controlling terminal, so when the stack --file-watch process attempts to read user input, it's treated like a job-controlled background process and placed in a stopped state.
The commit is five years old, so I have no idea why this bug has only surfaced now. Perhaps a change was made to input handling for stack --file-watch, or perhaps so few people use yesod devel these days that it takes five years to notice it isn't working (!?).
The simplest fix seems to be just deleting the setCreateGroup True decoration. Neither setDelegateCtlc nor setCreateGroup should be needed here, as far as I can see. In my testing with no decoration, the three processes (the controlling yesod devel process, the stack build --file-watch process, and the app/devel.hs server process) all seem to shut down fine whether you issue the quit command or hit Ctrl-C. This is expected: in the former case, the stack build --file-watch process exits cleanly, ending the race_; in the latter case, the default behavior with no setDelegateCtlc or setCreateGroup is to deliver SIGINT to all three processes in the process group, killing them all.