When executing some command(let\'s say \'x\') from cmd line, I get the following message: \"....Press any key to continue . . .\". So it waits for user input to unblock.
I think (although can't be certain) that you're talking about Windows rather than Unix?
If so, it's possible that the command line process isn't actually waiting for a key press (or input) on stdin
but instead doing the equivalent of the old DOS kbhit()
function.
AFAIK there's no way to make that function believe that the keyboard has been pressed without actually pressing a key.
To test this theory, create a text file "input.txt" with some blank lines in it, and run:
foo.exe < input.txt
That will show whether your program is waiting on stdin
or on something else.