Cleanup watchers properly
This commit is contained in:
parent
b4cf963495
commit
88dbfbd825
2 changed files with 36 additions and 5 deletions
|
@ -30,8 +30,22 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
simple-http-server --index --nocache "$@" & \
|
set -o monitor
|
||||||
tailwindcss --output tailwind.css --watch & \
|
|
||||||
|
simple-http-server --index --nocache "$@" &
|
||||||
|
PID_SERVER=$!
|
||||||
|
|
||||||
|
tailwindcss --output tailwind.css --watch &
|
||||||
|
PID_TAILWIND=$!
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "Stopping processes..."
|
||||||
|
|
||||||
|
kill "$PID_SERVER" "$PID_TAILWIND" 2>/dev/null || true
|
||||||
|
wait "$PID_SERVER" "$PID_TAILWIND" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
wait
|
wait
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
outputs = inputs:
|
outputs =
|
||||||
|
inputs:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
pkgs = import inputs.nixpkgs { inherit system; };
|
pkgs = import inputs.nixpkgs { inherit system; };
|
||||||
|
@ -18,8 +19,24 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
simple-http-server --index --nocache "$@" & \
|
set -o monitor
|
||||||
tailwindcss --input input.css --output tailwind.css --watch & \
|
|
||||||
|
simple-http-server --index --nocache "$@" &
|
||||||
|
PID_SERVER=$!
|
||||||
|
|
||||||
|
tailwindcss --input input.css \
|
||||||
|
--output tailwind.css \
|
||||||
|
--watch &
|
||||||
|
PID_TAILWIND=$!
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "Stopping processes..."
|
||||||
|
|
||||||
|
kill "$PID_SERVER" "$PID_TAILWIND" 2>/dev/null || true
|
||||||
|
wait "$PID_SERVER" "$PID_TAILWIND" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
wait
|
wait
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue