Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pretty process name #433

Merged
merged 1 commit into from
Feb 28, 2014
Merged

add pretty process name #433

merged 1 commit into from
Feb 28, 2014

Conversation

alepore
Copy link
Contributor

@alepore alepore commented Dec 22, 2013

Hi, I'm new to Puma, looks great so far :)

I noticed the lack of a pretty process name, this is my attempt to add a simple (static) one, very similar to what Thin server does.
This also accepts an optional --tag parameter for additional text (useful to recognize different apps)

fixes #415

@alepore
Copy link
Contributor Author

alepore commented Dec 22, 2013

puma --tag myapp config.ru will display this in ps:

$ ps | grep puma
62645 ttys001    0:00.51 puma 2.7.1 (tcp://0.0.0.0:9292) [myapp]

@@ -271,6 +271,8 @@ def run(background=true)
else
handle_servers
end

$0 = name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably not best to set $0 here. It should be done inside cli.rb instead, since Server can be embedded in another program and we shouldn't mess with their $0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we use Process.setproctitle if the target is running Ruby 2.1.0 or above?

@schneems
Copy link
Contributor

It's been 24 days, no update. Are you able to continue working on this PR?

@alepore
Copy link
Contributor Author

alepore commented Feb 19, 2014

i moved the code inside CLI, please take a look

else
Process.setproctitle process_title
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could make this a bit simpler

Process.respond_to?(:setproctitle) ? Process.setproctitle(process_title) : $0 = process_title

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure! updated commit

@schneems
Copy link
Contributor

Thanks for making changes i'm 👍 on this functionality

evanphx added a commit that referenced this pull request Feb 28, 2014
@evanphx evanphx merged commit 5dc0c75 into puma:master Feb 28, 2014
@schneems
Copy link
Contributor

❤️ 😍

@alepore alepore deleted the process-name branch March 1, 2014 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add app name for puma processes
4 participants