Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable terminal input #6480

Open
BebeSparkelSparkel opened this issue Feb 11, 2024 · 2 comments
Open

Add option to disable terminal input #6480

BebeSparkelSparkel opened this issue Feb 11, 2024 · 2 comments

Comments

@BebeSparkelSparkel
Copy link

Sometimes it is nice to multitask in a single shell and run stack build --file-watch & to run stack in the background. However, stack will ask for terminal input and that brings it to the foreground.

Could a flag be added to disable the command input between builds?

@mpilgrem
Copy link
Member

@BebeSparkelSparkel, thanks for the report. May I clarify first what you are experiencing? For example, I'm on Windows, using VS Code as the editor and running stack build --file-watch in a Windows Terminal pane. With that setup, there is no problem with the Windows Terminal pane coming to the foreground.

@BebeSparkelSparkel
Copy link
Author

This question explains what is going on exactly with a different program https://stackoverflow.com/questions/42361200/why-do-i-get-the-information-of-suspended-tty-input-when-i-run-my-script-in

From man bash

     To facilitate the implementation of the user interface to job control,
     the operating system maintains the notion of a current terminal process
     group ID.  Members of this process group (processes whose process group
     ID is equal to the current terminal process group ID) receive keyboard-
     generated signals such as SIGINT.  These processes are said to be in the
     foreground.  Background processes are those whose process group ID
     differs from the terminal's; such processes are immune to keyboard-
     generated signals.  Only foreground processes are allowed to read from
     or, if the user so specifies with stty tostop, write to the terminal.
     Background processes which attempt to read from (write to when stty
     tostop is in effect) the terminal are sent a SIGTTIN (SIGTTOU) signal by
     the kernel's terminal driver, which, unless caught, suspends the process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants