3 ms·
One of my favourite hacks is this script (which might well not work - it's flaky): https://bitbucket.org/twic/devtools/src/1b7a8f9ab849b36de70c6fe1cab2460fb265
by twic 9y ago
One of my favourite hacks is this script (which might well not work - it's flaky):
https://bitbucket.org/twic/devtools/src/1b7a8f9ab849b36de70c6fe1cab2460fb2657c6d/bin/killfd?at=default&fileviewer=file-view-default https://bitbucket.org/twic/devtools/src/1b7a8f9ab849b36de70c...
Which, given a specification of a filehandle (eg an IP address or path) uses lsof to determine the PID of the owning process and the numeric value of the filehandle, and then uses gdb to attach to that process and close it. It's a crude but simple way of exercising error-handling code.
- vram22 9y agoInteresting one. Are you running Elixir in the last line? the iex?
- twic 9y agoThat's this line, i think: sudo gdb -batch -n -iex "set auto-load off" -p $TARGET_PID -ex "call close(${TARGET_FD})" The -iex is a flag which executes a command on startup: -init-eval-command command -iex command Execute a single GDB command before loading the inferior (but after loading gdbinit files). See Startup. [1] https://sourceware.org/gdb/current/onlinedocs/gdb/File-Options.html#File-Options https://sourceware.org/gdb/current/onlinedocs/gdb/File-Optio...
- vram22 9y agoGot it now, thanks.