Hi All, I've been having some fun this evening exploring a new-to-me and so-far-excellent cross platform module for controlling and monitoring computer processes from inside python: *psutils* (https://github.com/giampaolo/psutil). It is more than worth the price of admission (time spent learning).
Here's the result of my efforts so far, 3 scripts (which I have as buttons) that - launch Vitalijie's history_tracer plugin backend server - Look for and list the process id and status for the server if found - Gracefully shutdown the server All from within Leo. :) I've cross posted the scripts and sample output here https://gist.github.com/maphew/b46aac7687ace48a6467e2dc84ed6fbd, so that there's less chance of copy-paste errors from email should anyone want to play with these. *An edited excerpt from the console which started Leo* don't forget to launch leo-ver-serv!!! ==== @int history-tracer-port=8088 ==== Looking for 'leo-ver-serv' processes... PID Name Status 3815 leo-ver-serv sleeping ======================================== This is just after Leo startup. The first thing I did was run the list services script. Sleeping is normal status for the server. But let's pretend we don't know this and we attempt to start the service: Running: leo-ver-serv /home/matt/.leo/.leoRecentFiles.txt 8088 thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 98, kind: AddrInUse, message: "Address already in use" }', src/libcore/result.rs:1188:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. Uhoh. List the services again: ==== @int history-tracer-port=8088 ==== Looking for 'leo-ver-serv' processes... PID Name Status 3815 leo-ver-serv sleeping 5335 leo-ver-serv zombie ======================================== So we still have our first real servivce, and a new zombie because of the crash above. Let's try and shut them down gracefully, and then list again: process psutil.Process(pid=5335, status='terminated') terminated with exit code 101 process psutil.Process(pid=3815, status='terminated') terminated with exit code None ==== @int history-tracer-port=8088 ==== Looking for 'leo-ver-serv' processes... PID Name Status ======================================== The double bar immediately following 'Status' indicates no services found. In the next version we should have it say *None* and remove guesswork. Now the scripts: *....nope, Google Groups keeps messing up the formatting.* See the gist link above. -matt -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/71184828-4c27-4818-a2e7-8073463fa483%40googlegroups.com.