foft
Certified Guru
I noticed that when I run the program I'm developing from pnd_run after I quit it runs anything I've typed in the terminal. In the app I poll the keys using EVIOCGKEY on evdev. Anyway if I happen to type ls+enter its not bad, but if I happen to type 'rm -rf /' then its not good!
I want to ensure this doesn't happen so I wrapped it in a script to flush the buffer after my app exits.
One method of doing this I found it:
However the pandora version does not understand this. So I found a perl version:
I put this at the end of the script and in a 'set -e' block.
This version works when I run from pnd_run. However if I have focus on a terminal open then run the pnd from the menu the commands are run in the terminal!
I'm clearly missing something since this shouldn't be hard - what is the trick here?
Thanks,
Mark
I want to ensure this doesn't happen so I wrapped it in a script to flush the buffer after my app exits.
One method of doing this I found it:
Code:
read -t 0.1 -N 1000000
However the pandora version does not understand this. So I found a perl version:
Code:
/usr/bin/perl -e 'use Fcntl; system("/bin/stty raw"); fcntl(STDIN,F_SETFL,O_NONBLOCK); my $buf; while(sysread(STDIN,$buf,4096)){}; system("/bin/stty cooked");'
I put this at the end of the script and in a 'set -e' block.
This version works when I run from pnd_run. However if I have focus on a terminal open then run the pnd from the menu the commands are run in the terminal!
I'm clearly missing something since this shouldn't be hard - what is the trick here?
Thanks,
Mark