mirror of
https://github.com/srid/nixos-config.git
synced 2026-05-11 17:36:07 +08:00
General cleanup
This commit is contained in:
parent
f9cf0def19
commit
66dcd9d9b6
7 changed files with 100 additions and 291 deletions
16
scripts/fuckport.nix
Normal file
16
scripts/fuckport.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ writeShellApplication, jc, jq, ... }:
|
||||
|
||||
# Kill the process with the port open
|
||||
# Used only to kill stale ghc.
|
||||
# FIXME: This doesn't work when lsof returns *multiple* processes.
|
||||
writeShellApplication {
|
||||
name = "fuckport";
|
||||
runtimeInputs = [ jc jq ];
|
||||
text = ''
|
||||
lsof -i :"$1"
|
||||
THEPID=$(lsof -i :"$1" | jc --lsof 2> /dev/null | jq '.[].pid')
|
||||
echo "KILL $THEPID ?"
|
||||
read -r
|
||||
kill "$THEPID"
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue