| 437 | } |
| 438 | |
| 439 | void plugin_kill(struct plugin *plugin, enum log_level loglevel, |
| 440 | const char *fmt, ...) |
| 441 | { |
| 442 | va_list ap; |
| 443 | const char *msg; |
| 444 | |
| 445 | va_start(ap, fmt); |
| 446 | msg = tal_vfmt(tmpctx, fmt, ap); |
| 447 | va_end(ap); |
| 448 | |
| 449 | log_(plugin->log, loglevel, |
| 450 | NULL, loglevel >= LOG_UNUSUAL, |
| 451 | "Killing plugin: %s", msg); |
| 452 | /* Unless, maybe, plugin was *really* important? */ |
| 453 | assert(plugin->pid != -1); |
| 454 | kill(plugin->pid, SIGKILL); |
| 455 | if (plugin->start_cmd) { |
| 456 | plugin_cmd_killed(plugin->start_cmd, plugin, msg); |
| 457 | plugin->start_cmd = NULL; |
| 458 | } |
| 459 | |
| 460 | tal_free(plugin); |
| 461 | } |
| 462 | |
| 463 | /** |
| 464 | * Send a JSON-RPC message (request or notification) to the plugin. |
no test coverage detected