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
Allow server process to start without detaching #11319
Conversation
@f1sherman I see that a bunch of CI jobs are currently failing. |
f9f5b2b
to
8b102d2
Compare
@bbatsov sorry about that! CI is fixed now. I was a little confused about the below offense since I didn't change that file, so I fixed that one in a separate commit.
|
No need for that the separated commit because this offense has already been resolved on the master branch: Can you rebase with the latest master branch? |
8b102d2
to
7012d4c
Compare
I wonder whether the term "daemon" is appropriate as I remember the conversation below: |
Done! |
I'm fully open to suggestions! Would |
7012d4c
to
42f5b2b
Compare
The code uses |
Thank you @f1sherman. Another use case for this: DarthSim/overmind#143 |
lib/rubocop/server/cli.rb
Outdated
].freeze | ||
EXCLUSIVE_OPTIONS = (SERVER_OPTIONS - %w[--server --no-server]).freeze | ||
NO_DAEMONIZE_OPTIONS = %w[--server --start-server].freeze |
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.
What do you think about --restart-server
here? Example, if you had started it daemonized and wanted to restart it in foreground?
Also, should we consider what the output should be if it's not daemonized?
Should it be --debug
output?
Should it show simple messages like "processing 5510 files" every time Rubocop is run?
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.
Thanks for the feedback! I've made an update to allow --no-daemonize
to be used with --restart-server
.
I don't have a very strong opinion about the process output. That said, with the new year starting I have less time to polish this PR up so I could certainly use an assist or strong point in the right direction on how to make the changes you're looking for if you'd be so kind. Thank you!
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.
I don't have strong opinions either, would rather just get this merged and then we can do a follow-up for the output
42f5b2b
to
184e33e
Compare
I think the most common name for such an option is usually "--nodetach" or "-no-detach". |
(it seems that even Docker favours this terminology) |
@@ -57,6 +57,12 @@ RuboCop version incompatibility found, RuboCop server restarting... | |||
RuboCop server starting on 127.0.0.1:60665. | |||
``` | |||
|
|||
If you would like to start the server without daemonizing the process, which can be useful when running within Docker, you can pass the `--no-daemonize` option. |
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.
without daemonizing -> in the foreground
@@ -92,6 +98,9 @@ These are the command-line options for server operations: | |||
|
|||
| `--server-status` | |||
| Show server status. | |||
|
|||
| `--no-daemonize` | |||
| Do not daemonize the server process. |
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.
Same here.
lib/rubocop/server/cli.rb
Outdated
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength: | ||
def run_command(server_command) | ||
def run_command(server_command, daemonize:) |
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.
daemonize -> detach
bd17f5d
to
be74773
Compare
Add a `--no-detach` option to `--start-server`. This makes it easy to run the RuboCop server process from within Docker, where detaching the process causes the container to exit.
0a1a87a
to
888c65d
Compare
@bbatsov thanks for the feedback, we should be all set once CI finishes 🤞 |
Add a
--no-detach
option to--start-server
and--restart-server
. This makes it easy to run the RuboCop server process from within Docker, where detaching the process causes the container to exit.Fixes #11188
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.