Open znichola opened 1 year ago
It feels like changing when we call silent_signals() does not work. Also, that wouldn't be enough. If we want to handle it properly, we'd need to be able to jump out of command preparation. How can we implement this without jumping directly to another part of our program without using goto or siglongjump? The heredoc function would need to constantly check if we've been interrupted, right?
I got an idea, it's to set a global g_interrupted in our signal handler and stop command preparation when g_interrupted is 1.
hmm, I feel like this is starting to get a bit hacky. I tried having a look at changing the position of the silent signals and termios, we could copy the standard behaviour for a ctrl+C
and just write a newline with no ctrl
characters printed by correctly setting up our signals only around the execution and not setup.
...
now that i think about it we could kindof hijack the global we have and make a new signal handeller for ctrl+C
that's only for prepare_pipeline
, we read the global retn and if it's something like 0xFFF
way above standard signals we know we've been interrupted by the special signal so stop heredoc getting and set retn value to 1 which bash does .