From e07c7461e313853cc014b9f1c655889aef6cc82a Mon Sep 17 00:00:00 2001 From: azam Date: Sat, 1 Jun 2024 17:52:16 +0900 Subject: [PATCH 1/5] Fix stdin pipe closed exception on Windows --- .../com/diffplug/spotless/ProcessRunner.java | 1 - .../gradle/spotless/BufIntegrationTest.java | 18 +- .../resources/protobuf/buf/buf_large.proto | 229 ++++++++++++++++++ .../protobuf/buf/buf_large.proto.clean | 229 ++++++++++++++++++ 4 files changed, 475 insertions(+), 2 deletions(-) create mode 100644 testlib/src/main/resources/protobuf/buf/buf_large.proto create mode 100644 testlib/src/main/resources/protobuf/buf/buf_large.proto.clean diff --git a/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java b/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java index 48307d7d3a..f110207e30 100644 --- a/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java +++ b/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java @@ -163,7 +163,6 @@ public LongRunningProcess start(@Nullable File cwd, @Nullable Map Date: Sat, 1 Jun 2024 18:08:56 +0900 Subject: [PATCH 2/5] Add to entries for #2147 to CHANGES.md files --- CHANGES.md | 3 ++- plugin-gradle/CHANGES.md | 3 ++- plugin-maven/CHANGES.md | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 04722f1c2b..272c46e181 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,13 +11,14 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Added -* `FileSignature.Promised` and `JarState.Promised` to facilitate round-trip serialization for the Gradle configuration cache. ([#1945](https://github.com/diffplug/spotless/pull/1945)) +* `FileSignature.Promised` and `JarState.Promised` to facilitate round-trip serialization for the Gradle configuration cache. ([#1945](https://github.com/diffplug/spotless/pull/1945)) * Respect `.editorconfig` settings for formatting shell via `shfmt` ([#2031](https://github.com/diffplug/spotless/pull/2031)) ### Fixed * Ignore system git config when running tests ([#1990](https://github.com/diffplug/spotless/issues/1990)) * Correctly provide EditorConfig property types for Ktlint ([#2052](https://github.com/diffplug/spotless/issues/2052)) * Made ShadowCopy (`npmInstallCache`) more robust by re-creating the cache dir if it goes missing ([#1984](https://github.com/diffplug/spotless/issues/1984),[2096](https://github.com/diffplug/spotless/pull/2096)) * scalafmt.conf fileOverride section now works correctly ([#1854](https://github.com/diffplug/spotless/pull/1854)) +* Fix stdin pipe is being closed exception on Windows for large .proto files ([#2147](https://github.com/diffplug/spotless/issues/2147)) ### Changes * Bump default `cleanthat` version to latest `2.16` -> `2.20`. ([#1725](https://github.com/diffplug/spotless/pull/1725)) * Bump default `gherkin-utils` version to latest `8.0.2` -> `9.0.0`. ([#1703](https://github.com/diffplug/spotless/pull/1703)) diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index 99160a6011..2b57790090 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -5,7 +5,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Added * Full, no-asterisk support of Gradle configuration cache. ([#1274](https://github.com/diffplug/spotless/issues/1274), giving up on [#987](https://github.com/diffplug/spotless/issues/987)) - * In order to use `custom`, you must now use Gradle 8.0+. + * In order to use `custom`, you must now use Gradle 8.0+. * Respect `.editorconfig` settings for formatting shell via `shfmt` ([#2031](https://github.com/diffplug/spotless/pull/2031)) * Add support for formatting and sorting Maven POMs ([#2082](https://github.com/diffplug/spotless/issues/2082)) ### Fixed @@ -15,6 +15,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( * Fixed memory leak introduced in 6.21.0 ([#2067](https://github.com/diffplug/spotless/issues/2067)) * Made ShadowCopy (`npmInstallCache`) more robust by re-creating the cache dir if it goes missing ([#1984](https://github.com/diffplug/spotless/issues/1984),[2096](https://github.com/diffplug/spotless/pull/2096)) * scalafmt.conf fileOverride section now works correctly ([#1854](https://github.com/diffplug/spotless/pull/1854)) +* Fix stdin pipe is being closed exception on Windows for large .proto files ([#2147](https://github.com/diffplug/spotless/issues/2147)) ### Changes * Bump default `cleanthat` version to latest `2.16` -> `2.20`. ([#1725](https://github.com/diffplug/spotless/pull/1725)) * Bump default `gherkin-utils` version to latest `8.0.2` -> `9.0.0`. ([#1703](https://github.com/diffplug/spotless/pull/1703)) diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index f3ba81d5bd..eedad0ba70 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -11,6 +11,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( * Correctly provide EditorConfig property types for Ktlint ([#2052](https://github.com/diffplug/spotless/issues/2052)) * Made ShadowCopy (`npmInstallCache`) more robust by re-creating the cache dir if it goes missing ([#1984](https://github.com/diffplug/spotless/issues/1984),[2096](https://github.com/diffplug/spotless/pull/2096)) * scalafmt.conf fileOverride section now works correctly ([#1854](https://github.com/diffplug/spotless/pull/1854)) +* Fix stdin pipe is being closed exception on Windows for large .proto files ([#2147](https://github.com/diffplug/spotless/issues/2147)) ### Changes * Bump default `cleanthat` version to latest `2.16` -> `2.20`. ([#1725](https://github.com/diffplug/spotless/pull/1725)) * Bump default `gherkin-utils` version to latest `8.0.2` -> `9.0.0`. ([#1703](https://github.com/diffplug/spotless/pull/1703)) From 224a0417f53cc1ac8afcb1c8acabf9556e56947a Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Mon, 3 Jun 2024 23:57:48 -0700 Subject: [PATCH 3/5] spotlessApply --- lib/src/main/java/com/diffplug/spotless/ProcessRunner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java b/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java index f110207e30..70ea30bdeb 100644 --- a/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java +++ b/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 DiffPlug + * Copyright 2020-2024 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From bd113c2930ddcf05ca33ab5954bc73b4d2724c35 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Tue, 4 Jun 2024 00:43:07 -0700 Subject: [PATCH 4/5] Try flushing instead of closing. --- lib/src/main/java/com/diffplug/spotless/ProcessRunner.java | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java b/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java index 70ea30bdeb..30ffd79de3 100644 --- a/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java +++ b/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java @@ -163,6 +163,7 @@ public LongRunningProcess start(@Nullable File cwd, @Nullable Map Date: Tue, 4 Jun 2024 01:08:00 -0700 Subject: [PATCH 5/5] flush before closing. --- lib/src/main/java/com/diffplug/spotless/ProcessRunner.java | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java b/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java index 30ffd79de3..e7755f75bd 100644 --- a/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java +++ b/lib/src/main/java/com/diffplug/spotless/ProcessRunner.java @@ -164,6 +164,7 @@ public LongRunningProcess start(@Nullable File cwd, @Nullable Map