summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-02-09 00:49:07 +0100
committerAlejandro Colomar <alx@kernel.org>2024-02-20 16:04:25 +0100
commit6aa5ef63ce52df598b73c496955f1c0fddd01fb4 (patch)
tree7a6ceae51b382fb8823ced70b761a1f4c8063eee
parentbc093ab3ee72ca9606fea821fe5c4af221737331 (diff)
downloadunit-6aa5ef63ce52df598b73c496955f1c0fddd01fb4.tar.gz
unit-6aa5ef63ce52df598b73c496955f1c0fddd01fb4.tar.bz2
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>
-rwxr-xr-xtools/setup-unit7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/setup-unit b/tools/setup-unit
index 5fb7218e..a0dafe10 100755
--- a/tools/setup-unit
+++ b/tools/setup-unit
@@ -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";