How to write data to existing process’s STDIN from external process?

Your code will not work. /proc/pid/fd/0 is a link to the /dev/pts/6 file. $ echo ‘foobar’ > /dev/pts/6 $ echo ‘foobar’ > /proc/pid/fd/0 Since both the commands write to the terminal. This input goes to terminal and not to the process. It will work if stdin intially is a pipe. For example, test.py is : … Read more

Read from file or stdin

You’re thinking it wrong. What you are trying to do: If stdin exists use it, else check whether the user supplied a filename. What you should be doing instead: If the user supplies a filename, then use the filename. Else use stdin. You cannot know the total length of an incoming stream unless you read … Read more

How to debug python CLI that takes stdin?

Another option is to create you own Pdb object, and set there the stdin and stdout. My proof of concept involves 2 terminals, but for sure some work can be merged some kind of very unsecure network server. Create two fifos: mkfifo fifo_stdin mkfifo fifo_stdout In one terminal, open stdout on background, and write to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)