con / duct

A helper to run a command, capture stdout/stderr and details about running
MIT License
1 stars 1 forks source link

Portability issue: `ps` on macOS does not have `-s` option #82

Open jwodder opened 2 weeks ago

jwodder commented 2 weeks ago

duct invokes ps with the -s option for filtering by session ID, but the version of ps available on macOS by default (as of macOS Sonomoa 14.5 on an Intel chip) does not have this option (or, seemingly, any way to directly filter by session).

asmacdo commented 2 weeks ago

Thats unfortunate-- ps -s is the backbone of how this whole thing works :/

jwodder commented 2 weeks ago

One possible option for working around this would be to give up on the idea of "no dependencies" (not sure why you're prioritizing that to begin with) and using https://github.com/giampaolo/psutil instead of ps.

asmacdo commented 2 weeks ago

Without dependencies, the script is runnable even without "installing" by just executing the script directly. @yarikoptic suggested this would be helpful in tightly controlled HPC environments.

jwodder commented 2 weeks ago

Surely such environments would still allow installation inside a virtualenv, though?

yarikoptic commented 2 weeks ago

https://github.com/giampaolo/psutil looks interesting ... but that one also does not seems to have a concept for "session" (upon a quick search).

I wonder what would be the preferable way then to track the children processes using psutil?

NB smells like we might need some pluggable/switchable setup to allow for different ways to track children processes if we decide to go cross-platform which in general would be great to have.