ruby / ruby/irb

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

Open
#991 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
478
Forks
158
Avg merge
1d 12h
Merged PRs (30d)
12

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by investigating IRB's command lifecycle and the .irbrc entry point, along with Ruby's Process.setproctitle API. The change should distinguish an actively running command from an idle session and expose a meaningful process title, including the requested idle timing where feasible.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.