-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Manually set a process title when using load #4589
Conversation
@@ -70,6 +71,14 @@ def kernel_load(file, *args) | |||
abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}" | |||
end | |||
|
|||
def process_title(file, *args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no reason to splat *args
here
With bundler 1.11.2, the process name for rake tasks looked like this: $ bundle exec rake foo:bar $ ps ux | grep rake user 1758 62.2 2.4 385816 202032 pts/3 Sl+ 16:16 0:04 ruby /usr/bin/rake foo:bar On bundler 1.12.0, the process name changed: $ bundle exec rake foo:bar $ ps ux | grep rake user 1758 62.2 2.4 385816 202032 pts/3 Sl+ 16:16 0:04 /usr/bin/rake The change in behaviour is caused by bundler 1.12 using `load` (instead of `exec`) where possible, and manually using `$0=` to set the command name. Unfortunately, that also alters the process title visible with ps, and using Process.setproctitle can help reverse that
Hi all, I haven't had much time to re-visit this, and we've since found a workaround for our use case. I'm happy to try and polish this into something that's mergable, but I'll need a bit more guidance on how to proceed. It seems |
@yob we typically use checks like |
I've manually addressed the comments on this in #4863 |
☔ The latest upstream changes (presumably #4863) made this pull request unmergeable. Please resolve the merge conflicts. |
With bundler 1.11.2, the process name for rake tasks include the task name:
On bundler 1.12.0, the process name changed:
The change in behaviour is caused by bundler 1.12 using
load
(instead ofexec
) wherepossible, and manually using
$0=
to set the command name. Unfortunately, that also altersthe process title visible with ps, and using
Process.setproctitle
can help reverse that.The tests are green on my ruby 2.3.1/linux system, but I haven't run them on older rubies or non-linux environments. I'm assuming they'll need some modifications to be maximally compatible, but let's see what happens.
See also: #4488