procs icon indicating copy to clipboard operation
procs copied to clipboard

Exclude procs process when using sudo

Open notDavid opened this issue 1 year ago • 2 comments

Hi there, fyi, not sure if it's an issue or some mis-understanding / configuration by me;

The procs process itself is only excluded when not using sudo:

$ procs test123
 PID:▲ User │ TTY CPU MEM CPU Time │ Command
            │     [%] [%]          │

$ sudo procs test123
 PID:▲ User │ TTY  CPU MEM CPU Time │ Command
            │      [%] [%]          │
 4372  root │ s004 0.0 0.0 00:00:00 │ sudo procs test123

Best, David.

-- procs 0.14.4 (installed via HomeBrew) macOS 14.3.1

notDavid avatar Mar 04 '24 19:03 notDavid

This is expected behaviour. The 4372 is sudo process, and the sudo process will launch procs. show_self = false option hides the self procs process only, so sudo process will be shown. If show_self = false are given, the result of sudo procs will be like below:

$ sudo procs test123
 PID:▲ User │ TTY  CPU MEM CPU Time │ Command
            │      [%] [%]          │
 4372  root │ s004 0.0 0.0 00:00:00 │ sudo procs test123
 4373  root │ s004 0.0 0.0 00:00:00 │ procs test123

dalance avatar Mar 05 '24 00:03 dalance

Thank you for explaining @dalance

Would you please consider to implement a feature to add a show_self_sudo = false setting?

Because currently if i want to watch some process, for example the borg processes with sudo procs --watch --tree borg, then the result is cluttered with multiple lines containing the entire tree of the sudo procs process (including the login shell, terminal program, etc.).

All of this is not relevant, and it makes it more difficult to read the result...

Thank you!

notDavid avatar Mar 05 '24 07:03 notDavid

I'll add show_self_parents option at #607. It suppress to show the parents processes which have self as the only child.

For example, in the following process tree, "bash - sudo - procs" will be hidden. The root "bash" will be shown because it has other process which are not related to procs as the children.

  • bash
    • bash
      • sudo
        • procs
    • vim
    • ssh

How about it?

dalance avatar Mar 06 '24 10:03 dalance

@dalance That would be the perfect solution i think.

notDavid avatar Mar 06 '24 14:03 notDavid

I've released v0.14.5.

dalance avatar Mar 07 '24 00:03 dalance

Tested, and it's working nicely now. Thank you for the quick fix!

notDavid avatar Mar 07 '24 16:03 notDavid