![xinput test terminal xinput test terminal](https://ubuntuhandbook.org/wp-content/uploads/2019/07/xinput-gui.jpg)
You get the same behavior with anything using stdio. It's just that when stdout is not a terminal, output is buffered.Īnd when you press Ctrl-C, that buffer is lost as/if it has not been written yet. My idea at present is that maybe by doing the redirect the program looses its ability to monitor the key-press key-release events.
![xinput test terminal xinput test terminal](https://www.bestshareware.net/img11/wine-big1.jpg)
This output I am able to redirect: //in file test.cįprintf(stderr,"key %s %d ", (Event.type = key_release_type) ? "release" : "press ", key->keycode) I modified the source to this (see next snippet below), which allows me to have a copy of the output on stderr. Printf("a=%d ", key->first_axis + loop, key->axis_data) Printf("key %s %d ", (Event.type = key_release_type) ? "release" : "press ", key->keycode) XDeviceKeyEvent *key = (XDeviceKeyEvent *) &Event It appears to me the output would be generated by an ordinary printf It seems the output is generated by this code (see snippet below).
#Xinput test terminal update#
I am really confused and hence ask here if the xinput program might have a way to avoid its output to be redirected? update This is also true for xinput test 10 &> output.file just to make sure I do not miss something on stdout or stderr. But when contrairy to my expectation the file output.file remains empty. Key press expected that this output could as usual be saved to a file like using xinput test 10 > output.file. I use the following command xinput test 10 and as expected I have the following xinput test 10 Today I have run across a situation I have not thought possible. someprogram &>.file (for both stdout+stderr combined).someprogram 2>output.of.stderr.file (for stderr).I am also aware of the two variants of this IO redirection: I do it whenever I want to save the output that a program generates to a file.