Closed jennybc closed 5 years ago
If you want the child process to clean itself up, you can use
PR_SET_PDEATHSIG
(on Linux...)
Another tidbit from @jmcphers. This is quite interesting because I suspect clipr only has a "process hygiene" problem on Linux (vs. macOS or Windows).
This all makes 100% sense when on CRAN.
But in interactive use, wouldn't this create unexpected behavior if one didn't realize that clipr would wipe your clipboard on X11 and X11 only on closing the R session?
Confirming: when you say "wipe", I assume you mean "kill" (versus just remove the clipboard contents) (?).
I think processx (or actually the ps package) will provide a way for clipr to mark an xsel or xclip process that it launches (vs. a pre-existing one). And then presumably it would be safe / not shocking for clipr to kill such a process that it basically "owns".
Again, I wouldn't do anything about this now but would reconsider when there are better facilities for process management from R.
cc @gaborcsardi
So, dev versions of processx and ps have functionality to:
I'm just parking this here for the future, so feel free to close if it bothers you to leave it open. But, as you know, on linux, the use of clipr launches but does not close a process (via xsel and/or xclip). Which has caused trouble on CRAN with packages that actually exercise clipr code via example, test, or vignette. Everyone's current solution seems to be shutting down or removing all such code from CRAN. That is expedient and necessary, but doesn't really seem like a solution that leads to software quality.
Food for future thought, via @kevinushey