Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit c8411a4

Browse files
authored
Merge pull request #1120 from este6an13/main
fix(build): #1002 args manage ports fix
2 parents 91ee9fe + 61e1d07 commit c8411a4

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

.mailmap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Daniel Salazar <[email protected]> Daniel Salazar <[email protected]>
66
David Acevedo <[email protected]> David Acevedo <[email protected]>
77
David Arnold <[email protected]> David Arnold <[email protected]>
88
David Arnold <[email protected]> David Arnold <[email protected]>
9+
Diego Quintero <[email protected]> Diego Quintero <[email protected]>
10+
Diego Quintero <[email protected]> este6an13 <[email protected]>
911
Diego Restrepo <[email protected]> Diego Restrepo Mesa <[email protected]>
1012
Diego Restrepo <[email protected]> Diego Restrepo <[email protected]>
1113
Diego Restrepo <[email protected]> Diego Restrepo Mesa <[email protected]>

src/args/make-template/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
then
2626
abort ''
2727
28-
Ivalid placeholder: ${k}
28+
Invalid placeholder: ${k}
2929
Placeholders must match: ${argumentRegex}
3030
For example: __argExample123__
3131

src/args/manage-ports/default.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
{
22
__nixpkgs__,
33
makeTemplate,
4+
__shellCommands__,
45
...
56
}:
67
makeTemplate {
8+
replace = {
9+
__argShellCommands__ = __shellCommands__;
10+
};
711
name = "manage-ports";
812
searchPaths = {
913
bin = [

src/args/manage-ports/template.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
# shellcheck shell=bash
22

3+
source __argShellCommands__
4+
35
function _kill_port {
46
local pids
57
local port="${1}"
68

79
pids="$(mktemp)" \
810
&& if ! lsof -t "-i:${port}" > "${pids}"; then
9-
info "Nothing listening on port: ${port}" \
11+
info "No process was found listening on port ${port}" \
1012
&& return 0
1113
fi \
1214
&& while read -r pid; do
1315
if kill -9 "${pid}"; then
1416
if timeout 5 tail --pid="${pid}" -f /dev/null; then
15-
info "Killed pid: ${pid}, listening on port: ${port}"
17+
info "Process listening on port ${port} with PID ${pid} was successfully killed"
1618
else
17-
warn "kill timeout pid: ${pid}, listening on port: ${port}"
19+
warn "Timeout while attempting to kill process with PID ${pid} listening on port ${port}"
1820
fi
1921
else
20-
error "Unable to kill pid: ${pid}, listening on port: ${port}"
22+
error "Unable to kill process with PID ${pid} listening on port ${port}"
2123
fi
2224
done < "${pids}"
2325
}
@@ -50,7 +52,7 @@ function wait_for_tcp {
5052
error "Timeout while waiting for ${host}:${port} to open" \
5153
&& return 1
5254
else
53-
info "Waiting 1 second for ${host}:${port} to open, ${elapsed} seconds in total" \
55+
info "Waiting 1 second for ${host}:${port} to open: ${elapsed} seconds in total" \
5456
&& sleep 1 \
5557
&& elapsed="$(("${elapsed}" + 1))" \
5658
&& continue

0 commit comments

Comments
 (0)