Skip to content

How do I know if the terminal is running a command? #4575

Answered by jerch
CaledoniaProject asked this question in Q&A
Discussion options

You must be logged in to vote

How can I know if the console is busy? e.g running vim

Well - you cant. A terminal is just an IO device for interactive keyboard input and screen output, where the OS redirects process stdin and stdout to (through TTY/PTY abstraction).

some explanation
The commands are launched by another process, typically a shell. It is important to understand that terminal != shell - if you want control/knowledge about the processes being spawned and attached to the TTY, you'd have to hook into the shell's command evaluation (the E in REPL). With an interactive shell + command execution the situation gets further complicated by the fact, that commands can be interactive itself (its own REPL) temporar…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Tyriar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants