Not sure why open_pipe made a temp directory, now it makes a temp file instead

This commit is contained in:
Jesse Gardner 2021-04-15 19:21:53 -07:00
parent 5ba009a885
commit 67d8b3ffb7
1 changed files with 4 additions and 5 deletions

View File

@ -60,11 +60,10 @@ open_pipe ()
#=========================================================================# #=========================================================================#
{ {
check_pipe && return check_pipe && return
local TEMPDIR local fifo_path
TEMPDIR=$(mktemp -d) || temp_error fifo_path=$(mktemp) || temp_error
#shellcheck disable=2064 #shellcheck disable=2064
trap "exec 3>&-; exec 3<&-;rm -rf $TEMPDIR" EXIT trap "exec 3>&-; exec 3<&-;rm -f $fifo_path" EXIT
fifo_path="${TEMPDIR}/qq2clone_fifo"
mkfifo "$fifo_path" || fifo_error mkfifo "$fifo_path" || fifo_error
exec 3<>"$fifo_path" exec 3<>"$fifo_path"
return 0 return 0
@ -110,7 +109,7 @@ write_pipe ()
{ {
# We put a + at the beginning of every line to let read_pipe work in a # We put a + at the beginning of every line to let read_pipe work in a
# non-blocking manner # non-blocking manner
local line local line
if (($1)); then if (($1)); then
while IFS= read -r line; do while IFS= read -r line; do
echo "+$line" >&3 echo "+$line" >&3