franciscolourenco / done

A fish-shell package to automatically receive notifications when long processes finish.
MIT License
770 stars 70 forks source link

Feature - Warn when program hanging or waiting for user input #39

Closed BarbzYHOOL closed 9 months ago

BarbzYHOOL commented 6 years ago

I don't know if it's possible but what about warning the user when the program is hanging or when there is a prompt to answer?

That would be really really helpful

franciscolourenco commented 5 years ago

I don't know any way to detect if the current process is waiting for user input. @jorgebucaran any ideas?

jorgebucaran commented 5 years ago

@BarbzYHOOL Do you mean when a background process is hanging? 🤔

BarbzYHOOL commented 5 years ago

Example: you run ansible which auto installs stuff, and at some point, it asks for a prompt (or it asks at start but you launch ansible and you immediately alt+tab) but you're doing something else and the auto install never completes because of that.

jorgebucaran commented 5 years ago

@BarbzYHOOL Would ansible run as a background job in a subshell or in a different shell like on a new tab or window?

BarbzYHOOL commented 5 years ago

In a new window because it takes a long time so I switch, and not in background (basically that's what "done" is about :P and in new tab it's not detected, I already opened an issue for new tab and i looked on google, but didn't find how to make "done" work with new tabs)

ammgws commented 4 years ago

Unfortunately this doesn't look like something that can be trivially implemented.

ammgws commented 4 years ago

If using tmux you could check the last line of the terminal and pattern match it. e.g. tmux capture-pane -p -t "paneid" | tac | grep -E -m 1 . | sed -e 's/^[ \t]*//'

If it was stuck at a sudo prompt it would return: [sudo] password for yourusename:

Then if the window was not focused you could send a notificiation.

Caveats:

RaitoBezarius commented 4 years ago

That would require to know that the program is stuck into a read syscall on stdin, that sounds very difficult IMHO

franciscolourenco commented 3 years ago

Marked as wontfix since nobody can see how this would be possible, but feel free to comment if someone has an idea.