in reply to Re^2: I need some help with open2
in thread I need some help with open2
If sox is sending you data and you're not reading it, the pipe will fill up and sox will block trying to print to the pipe.
One bug: You never call waitpid to cleanup the zombie child process.
Another bug: You pass user-provided text the shell without (usefully) validating it and without escaping it.
"sox -t $type - -s -r 8000 -w -t wav - 2>/dev/null"
should be
"sox -t \Q$type\E - -s -r 8000 -w -t wav - 2>/dev/null"
You should probably flush your pipe after writing to it (or turn on autoflushing on it).
Update: I had the sox and the parent program mixed up. Fixed.
|
|---|