may_kill_dev
This commit is contained in:
Vendored
+2
-2
@@ -4,8 +4,8 @@
|
||||
"type": "ruby_lsp",
|
||||
"name": "Debug Rails",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "PKILL: /bin/dev",
|
||||
"program": "${workspaceFolder}/bin/rails server --port 3000",
|
||||
"preLaunchTask": "ASK_FOR_KILL_RAILS",
|
||||
"program": "${workspaceFolder}/bin/rails server --port 3000 -b 127.0.0.1",
|
||||
},
|
||||
]
|
||||
}
|
||||
Vendored
+1
@@ -11,4 +11,5 @@
|
||||
"emmet.includeLanguages": {
|
||||
"erb": "html"
|
||||
},
|
||||
"debug.onTaskErrors": "abort"
|
||||
}
|
||||
Vendored
+7
-5
@@ -2,13 +2,15 @@
|
||||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "PKILL: /bin/dev",
|
||||
"command": "kill -9 $(ss -tlnp | grep 3000 | grep -oP \"pid=\\K(\\d+)\" | head -n1)",
|
||||
"detail": "Pkill previous Rails server",
|
||||
"label": "ASK_FOR_KILL_RAILS",
|
||||
"command": "${workspaceFolder}/bin/may_kill_dev.sh",
|
||||
"detail": "ASK before killing the currently running Rails server",
|
||||
"presentation": {
|
||||
"showReuseMessage": false,
|
||||
"reveal": "silent",
|
||||
"close": true
|
||||
"reveal": "always",
|
||||
"close": true,
|
||||
"panel": "dedicated",
|
||||
"echo": false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
PORT=3000
|
||||
|
||||
pid_rails=$(ss -tlnp | grep "$PORT" | grep -oP "pid=\K(\d+)" | head -n1)
|
||||
if [[ -n $pid_rails ]]; then
|
||||
echo "============================================================================"
|
||||
echo "Rails already runs on port $PORT, You've asked for debugger on the same port."
|
||||
echo "============================================================================"
|
||||
echo -n "Do you to want to kill rails process in order to launch debugger: (y/N)?: "
|
||||
read -n1 answer
|
||||
case $(echo $answer | tr '[A-Z]' '[a-z]') in
|
||||
y|yes) kill -15 $pid_rails ;;
|
||||
*) echo " means NO"; exit 1 ;;
|
||||
esac
|
||||
else
|
||||
echo "port $PORT is free for debugger, go on..."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user