-
-
Save h3llix/eabd465939d20458740aa5efc8206873 to your computer and use it in GitHub Desktop.
Write to STDIN of running Process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Alternative 1: write to file descriptor (not usable) | |
input='testing' | |
pid=1212 | |
echo $input > /proc/$pid/fd/0 | |
## Alternative 2: Pipe fifo to the app | |
fifo_file=/tmp/fifo | |
mkfifo $fifo_file; cat > $fifo_file &; echo $! > {$fifo_file}.pid | |
(cat $fifo_file | myapp) | |
echo "testing" > $fifo_file | |
kill -9 `cat $fifo_file.pid` && rm $fifo_file* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment