Skip to content

Commit ed7624e

Browse files
litchrustyrussell
authored andcommitted
Warning added to PLUGIN documentation re: stdin
Adds some warning/documentation about the `println!`/`dbg!` causing my bad times as a plugin developer. =)
1 parent 1eaec22 commit ed7624e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/PLUGINS.md

+12
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ used as protocol on top of the two streams, with the plugin acting as
2222
server and `lightningd` acting as client. The plugin file needs to be
2323
executable (e.g. use `chmod a+x plugin_name`)
2424

25+
### Warning
26+
27+
As noted, `lightningd` uses `stdin` as an intake mechanism. This can
28+
cause unexpected behavior if one is not careful. To wit, care should
29+
be taken to ensure that debug/logging statements must be routed to
30+
`stderr` or directly to a file. Activities that are benign in other
31+
contexts (`println!`, `dbg!`, etc) will cause the plugin to be killed
32+
with an error along the lines of:
33+
34+
`UNUSUAL plugin-cln-plugin-startup: Killing plugin: JSON-RPC message
35+
does not contain "jsonrpc" field`
36+
2537
## A day in the life of a plugin
2638

2739
During startup of `lightningd` you can use the `--plugin=` option to

0 commit comments

Comments
 (0)