Skip to content

Commit

Permalink
Autoflush PrintWriter when consuming from stdin (#167)
Browse files Browse the repository at this point in the history
* fix: autoflush printwriter when consuming from stdin
  • Loading branch information
dainiusjocas authored Feb 18, 2022
1 parent 635a946 commit 83bbb4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ For a list of breaking changes, check [here](#breaking-changes).

## Unreleased

- Fixed flushing behaviour when consuming from STDIN in the ruby-percolator example.
- `LMGREP_FEATURE_EPSILON_GC`: use [Epsilon GC](https://www.graalvm.org/22.0/reference-manual/native-image/MemoryManagement/) in the binary.

## v2022.02.17
Expand Down
3 changes: 2 additions & 1 deletion src/lmgrep/only_analyze.clj
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
[nil])
custom-analyzers (analysis/prepare-analyzers (get options :analyzers-file) options)
^Analyzer analyzer (analyzer/create analysis-conf custom-analyzers)
^PrintWriter writer (PrintWriter. (BufferedWriter. *out* print-writer-buffer-size))]
^PrintWriter writer (PrintWriter. (BufferedWriter. *out* print-writer-buffer-size)
^Boolean (empty? files-pattern))]
(if (get options :graph)
(graph files-to-analyze writer analyzer options)
(execute-analysis files-to-analyze writer analyzer options))))
Expand Down
3 changes: 2 additions & 1 deletion src/lmgrep/unordered.clj
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
queue-size (get options :queue-size 1024)
with-empty-lines (get options :with-empty-lines)
consume-fn (if preserve-order? ordered-consume-reader unordered-consume-reader)
^PrintWriter writer (PrintWriter. (BufferedWriter. *out* print-writer-buffer-size))
^PrintWriter writer (PrintWriter. (BufferedWriter. *out* print-writer-buffer-size)
^Boolean (empty? file-paths-to-analyze))
^ExecutorService matcher-thread-pool-executor (c/thread-pool-executor concurrency queue-size)
^ExecutorService writer-thread-pool-executor (c/single-thread-executor)]
(doseq [^String path (if (empty? file-paths-to-analyze)
Expand Down

0 comments on commit 83bbb4f

Please sign in to comment.