Skip to content

Commit

Permalink
Write to stdout ASAP in server mode
Browse files Browse the repository at this point in the history
Don't wait for a full 4KB of output, or a timeout, just write it as
we get it. This makes the experience feel much more like you're running
rubocop directly
  • Loading branch information
ccutrer committed Jul 14, 2022
1 parent a206fcd commit 795f830
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/change_no_buffer_server_stdout.md
@@ -0,0 +1 @@
* [#10814](https://github.com/rubocop/rubocop/pull/10814): Avoid buffering stdout when running in server mode. ([@ccutrer][])
2 changes: 1 addition & 1 deletion lib/rubocop/server/client_command/base.rb
Expand Up @@ -29,7 +29,7 @@ def send_request(command:, args: [], body: '')
socket.puts [Cache.token_path.read, Dir.pwd, command, *args].shelljoin
socket.write body
socket.close_write
$stdout.write socket.read(4096) until socket.eof?
$stdout.write socket.readpartial(4096) until socket.eof?
end
end

Expand Down

0 comments on commit 795f830

Please sign in to comment.