Skip to content

[feature request] Automatically set process title to currently running command #991

@dmke

Description

@dmke

Description

Colleagues of mine regularly SSH into our servers, start an IRB session to look something up, and forget to logout. When they store database query results in local variables, they obviously occupy memory and can't be garbage collected.

It has happened on more than one occasion that I need to manually free resources because half a dozen IRB sessions have multiple GB of memory allocated. I would like to avoid currently active sessions though (i.e. where a user is actively collecting information).

As far as I can tell, I have no information what an IRB process is currently doing. I can't rely on CPU usage, as swapping may induce some load (on Ubuntu 24.04, I have noticed an otherwise idle IRB process to use up to 1% of CPU in top).

It would be useful if IRB would update the process title (Process.setproctitle) to something meaningful, for example:

  • "irb - running ...", when a command is currently running (maybe show the first few characters of the command?)
  • "irb - idle since 13:55", when no command is running

Maybe this is achievable through a piece of code in .irbrc, but I haven't figured out how to do that.

Result of irb_info

irb(main):001> irb_info
Ruby version: 3.2.3
IRB version: irb 1.14.0 (2024-07-06)
InputMethod: RelineInputMethod with Reline 0.5.9
Completion: Autocomplete, RegexpCompletor
.irbrc paths: /home/[redacted]/.irbrc
RUBY_PLATFORM: x86_64-linux-gnu
LANG env: en_US.UTF-8
East Asian Ambiguous Width: 1

This is Ruby/IRB from Ubuntu 24.04 packages.

Terminal Emulator

Tilix on the workstation. This should not matter

Setting Files

Are you using ~/.irbrc and ~/.inputrc?

  • not really, ~/.irbrc includes only commented # IRB.conf[:USE_MULTILINE] = false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions