Fixed write_pipe bug
This commit is contained in:
parent
62e36d07e9
commit
5ba009a885
9
qq2clone
9
qq2clone
|
@ -105,20 +105,21 @@ write_pipe ()
|
|||
# OUTPUT: None
|
||||
# PARAMETERS: $1: '0' if passing another parameter(s), '1' if writing to
|
||||
# stdin instead.
|
||||
# $2 and on: If $1 is 0, this is the information write_pipe will
|
||||
# write as "$*"
|
||||
# $2 and on: If $1 is 0, write_pipe will write the remaining parameters
|
||||
#=========================================================================#
|
||||
{
|
||||
# We put a + at the beginning of every line to let read_pipe work in a
|
||||
# non-blocking manner
|
||||
if (($1)); then
|
||||
local line
|
||||
if (($1)); then
|
||||
while IFS= read -r line; do
|
||||
echo "+$line" >&3
|
||||
done
|
||||
else
|
||||
shift
|
||||
echo "+$*" >&3
|
||||
echo "$@" | while IFS= read -r line; do
|
||||
echo "+$line" >&3
|
||||
done
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue