Tools: setup-unit: ctl edit: Append suffix to tmp file name

This allows the editor(1) to enable syntax highlighting.  See
suffixes(7).

Cc: Liam Crilly <liam@nginx.com>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-02-09 00:49:07 +01:00
parent bc093ab3ee
commit 6aa5ef63ce

View File

@@ -421,7 +421,12 @@ unit_ctl_edit()
fi;
local req_path="$1";
local tmp="$(mktemp)";
echo "$req_path" \
| sed 's%^/js_modules/.*%.js%' \
| sed 's%^/config\>.*%.json%' \
| sed 's%^/.*%.txt%' \
| xargs mktemp --suffix \
| read -r tmp;
unit_ctl_http ---s "$sock" -c --no-progress-meter GET "$req_path" \
</dev/null >"$tmp";