Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

Process.setproctitle

(::String arg0) -> ::String
Process.setproctitle(string) → string

Sets the process title that appears on the ps(1) command. Not necessarily effective on all platforms. No exception will be raised regardless of the result, nor will NotImplementedError be raised even if the platform does not support the feature.

Calling this method does not affect the value of $0.

Example
Process.setproctitle('myapp: worker #%d' % worker_id)

This method first appeared in Ruby 2.1 to serve as a global variable free means to change the process title.

See also .setpriority .setrlimit .setpgrp .setsid also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0