You would need to explain exactly what your end goal is such that somebody in here can explain if this would make sense and if it would work. Why would you need to fake pressing some keys in the first place ?
Hashcat is distributed as a library libhashcat see src/Makefile , all the architecture of hashcat is basically just designed in a way that the hashcat binary itself basically makes use of the "library", it essentially incorporates the libhashcat library. Maybe it would make sense (in very specific cases) to just make use of this libhashcat library, instead of building a wrapper around it.
We had several similar questions in the past and users tried very hard to build wrappers around it (to be fair, at that time the library architecture didn't exist yet): e.g.
https://hashcat.net/forum/thread-4754.html
The "problem" is that the input is in a certain mode, i.e. you don't need to press the enter key after for instance hitting
"s" and the mode also only expects and accepts one single character (only s, or only q, or only c, ...).
It was explained here and is working similar to this:
https://stackoverflow.com/questions/2154...0#21595810
Of course, this has nothing to do with what characters you sent to hashcat, but how you provide the input and which modes you active/use in your wrapper.
Again, I wouldn't really use this interactive wrapper strategy (because the way hashcat deals with input etc might change in the future etc), but I would suggest to use the --status and safetly kill/exit the "subprocess" or as explained above use the way it was intended to be used: as a library (Instead of a black box).