jespada on Nostr: #+begin_src elisp (defun kill-proc (proc) "Kill process PROC identified by its PID or ...
#+begin_src elisp
(defun kill-proc (proc)
"Kill process PROC identified by its PID or name."
(if (string-match-p "^[0-9]+$" proc)
(shell-command (format "kill -9 %s" proc))
(shell-command (format "pkill -9 %s" proc))))
(kill-proc "vim")
#+end_src
Published at
2023-09-14 14:34:57Event JSON
{
"id": "69c73718ef414cf1fd82ff9091d77589f8ffae9b5337bb18d548bee5408b5c3c",
"pubkey": "f57d8cf57ba293a764cd30f3461ce21b0a3849c5c03533391a1074412602f7c9",
"created_at": 1694702097,
"kind": 1,
"tags": [
[
"e",
"b0ee6fba990f7d518263def07656c4a9d40cdfba3fe24c98ffc01ab02f910c0a",
"",
"reply"
],
[
"p",
"d91191e30e00444b942c0e82cad470b32af171764c2275bee0bd99377efd4075"
]
],
"content": "#+begin_src elisp\n(defun kill-proc (proc)\n \"Kill process PROC identified by its PID or name.\"\n (if (string-match-p \"^[0-9]+$\" proc)\n (shell-command (format \"kill -9 %s\" proc))\n (shell-command (format \"pkill -9 %s\" proc))))\n\n(kill-proc \"vim\")\n\n #+end_src",
"sig": "1a30ed8341f6919033abbbfe8b45adf0d3f69174b0ca00855f830c1eb9cfa97ceaca7eea7abfcdf52398dc4922e6e9d5b7e50efa38ce2009c2638dfd92f581cf"
}