[Git][java-team/zt-exec][upstream] New upstream version 1.13.0

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Fri Nov 13 12:13:58 GMT 2026



Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / zt-exec


Commits:
b184943b by Emmanuel Bourg at 2026-11-13T12:44:37+01:00
New upstream version 1.13.0
- - - - -


27 changed files:

- + .github/SECURITY.md
- + .github/dependabot.yml
- + .github/scripts/prepare-changelog-release.sh
- + .github/workflows/build.yml
- + .github/workflows/codeql.yml
- + .github/workflows/dependency-submission.yml
- + .github/workflows/release.yml
- .gitignore
- − .mvn/wrapper/MavenWrapperDownloader.java
- − .mvn/wrapper/maven-wrapper.properties
- − .travis.yml
- + CHANGELOG.md
- − Changelog.txt
- README.md
- + build.gradle.kts
- − get_release_commands.sh
- + gradle/libs.versions.toml
- − mvnw
- − mvnw.cmd
- − pom.xml
- + settings.gradle.kts
- src/main/java/org/zeroturnaround/exec/ProcessExecutor.java
- + src/main/java/org/zeroturnaround/exec/stream/LineConsumer.java
- src/main/java/org/zeroturnaround/exec/stream/LogOutputStream.java
- + src/moduleInfo/java/module-info.java
- src/test/java/org/zeroturnaround/exec/test/LogOutputStreamTest.java
- src/test/java/org/zeroturnaround/exec/test/ProcessListenerThrowTest.java


Changes:

=====================================
.github/SECURITY.md
=====================================
@@ -0,0 +1,19 @@
+# Security Policy
+
+## Reporting a Vulnerability
+
+Please report security vulnerabilities privately rather than opening a public issue.
+
+Use GitHub's private vulnerability reporting: open the
+[Security tab](https://github.com/zeroturnaround/zt-exec/security) and click
+**"Report a vulnerability"**. This creates a private advisory visible only to
+you and the maintainers.
+
+We aim to acknowledge reports within a few working days and will keep you
+informed as we investigate and prepare a fix. When a fix is released we publish
+a security advisory and credit the reporter unless you prefer to remain anonymous.
+
+## Supported Versions
+
+Security fixes are made against the latest released version. Please make sure you
+are on the most recent release before reporting an issue.


=====================================
.github/dependabot.yml
=====================================
@@ -0,0 +1,24 @@
+version: 2
+updates:
+  # Gradle dependencies, including the version catalog (gradle/libs.versions.toml).
+  - package-ecosystem: "gradle"
+    directory: "/"
+    schedule:
+      interval: "weekly"
+    groups:
+      # Bundle minor/patch bumps into one PR; majors stay separate for review.
+      minor-and-patch:
+        update-types:
+          - "patch"
+          - "minor"
+
+  # GitHub Actions used by the workflows in .github/workflows.
+  - package-ecosystem: "github-actions"
+    directory: "/"
+    schedule:
+      interval: "weekly"
+    groups:
+      minor-and-patch:
+        update-types:
+          - "patch"
+          - "minor"


=====================================
.github/scripts/prepare-changelog-release.sh
=====================================
@@ -0,0 +1,60 @@
+#!/usr/bin/env bash
+#
+# Promote the "Unreleased" section of CHANGELOG.md into a dated release section
+# and update the comparison links at the bottom of the file. Run by the Release
+# workflow; can also be run by hand before a release.
+#
+# Usage: prepare-changelog-release.sh <version>
+#   e.g. prepare-changelog-release.sh 1.18.0
+#
+# The release date is today's date in UTC and the release tag is "v<version>",
+# matching the tag the Release workflow creates.
+set -euo pipefail
+
+version="${1:?usage: prepare-changelog-release.sh <version>}"
+changelog="CHANGELOG.md"
+date="$(date -u +%Y-%m-%d)"
+new_tag="v${version}"
+
+# The "[Unreleased]" link encodes the previous release tag as the base of its
+# compare range, e.g. ".../compare/zt-exec-1.12...HEAD" -> previous tag zt-exec-1.12.
+unreleased_link="$(grep -E '^\[Unreleased\]:' "$changelog" || true)"
+base_url="$(printf '%s\n' "$unreleased_link" | sed -E 's#^\[Unreleased\]: (https?://[^ ]+)/compare/.*#\1#')"
+prev_tag="$(printf '%s\n' "$unreleased_link" | sed -E 's#^.*/compare/(.+)\.\.\.HEAD$#\1#')"
+
+if [ -z "$base_url" ] || [ -z "$prev_tag" ] || [ "$base_url" = "$unreleased_link" ]; then
+  echo "Could not parse the [Unreleased] comparison link in $changelog" >&2
+  exit 1
+fi
+
+# Refuse to release an empty Unreleased section.
+if ! awk '
+    /^## \[Unreleased\]/ { in_section = 1; next }
+    /^## \[/             { in_section = 0 }
+    in_section && /[^[:space:]]/ { found = 1 }
+    END { exit found ? 0 : 1 }
+  ' "$changelog"; then
+  echo "The [Unreleased] section is empty; nothing to release." >&2
+  exit 1
+fi
+
+awk -v version="$version" -v date="$date" -v new_tag="$new_tag" \
+    -v prev_tag="$prev_tag" -v base_url="$base_url" '
+  # Keep the (now empty) Unreleased header and open a dated section below it.
+  /^## \[Unreleased\]/ {
+    print
+    print ""
+    print "## [" version "] - " date
+    next
+  }
+  # Rewrite the Unreleased compare link and add the new release link below it.
+  /^\[Unreleased\]:/ {
+    print "[Unreleased]: " base_url "/compare/" new_tag "...HEAD"
+    print "[" version "]: " base_url "/compare/" prev_tag "..." new_tag
+    next
+  }
+  { print }
+' "$changelog" > "$changelog.tmp"
+
+mv "$changelog.tmp" "$changelog"
+echo "Promoted Unreleased to [$version] - $date (tag $new_tag, previous $prev_tag)."


=====================================
.github/workflows/build.yml
=====================================
@@ -0,0 +1,42 @@
+name: Build
+
+on:
+  push:
+    branches: [master, main]
+  pull_request:
+    branches: [master, main]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout at v7
+
+      - name: Set up Java
+        uses: actions/setup-java at v5
+        with:
+          distribution: temurin
+          java-version: 24
+
+      - name: Set up Gradle
+        uses: gradle/actions/setup-gradle at v6
+
+      # `build` runs `assemble` + `check` (which includes `test`). The Java
+      # toolchain needed to compile is auto-provisioned by the foojay resolver.
+      - name: Build and test
+        run: ./gradlew build
+
+      - name: Upload jar
+        uses: actions/upload-artifact at v7
+        with:
+          name: zt-exec
+          path: build/libs/*.jar
+          retention-days: 7
+
+      - name: Upload test reports
+        if: always()
+        uses: actions/upload-artifact at v7
+        with:
+          name: test-reports
+          path: build/reports/tests/
+          retention-days: 7


=====================================
.github/workflows/codeql.yml
=====================================
@@ -0,0 +1,43 @@
+name: CodeQL
+
+on:
+  push:
+    branches: [master, main]
+  pull_request:
+    branches: [master, main]
+  schedule:
+    # Weekly scan to catch newly published queries against unchanged code.
+    - cron: '23 4 * * 1'
+
+jobs:
+  analyze:
+    name: Analyze (java)
+    runs-on: ubuntu-latest
+    permissions:
+      security-events: write
+      contents: read
+    steps:
+      - uses: actions/checkout at v7
+
+      - name: Set up Java
+        uses: actions/setup-java at v5
+        with:
+          distribution: temurin
+          java-version: 24
+
+      - name: Set up Gradle
+        uses: gradle/actions/setup-gradle at v6
+
+      - name: Initialize CodeQL
+        uses: github/codeql-action/init at v4
+        with:
+          languages: java-kotlin
+          build-mode: manual
+
+      - name: Build
+        run: ./gradlew compileJava --no-daemon
+
+      - name: Perform CodeQL Analysis
+        uses: github/codeql-action/analyze at v4
+        with:
+          category: "/language:java-kotlin"


=====================================
.github/workflows/dependency-submission.yml
=====================================
@@ -0,0 +1,25 @@
+name: Dependency Submission
+
+# Submits the full Gradle dependency graph to GitHub so that Dependabot can
+# raise security alerts (and updates) for vulnerable transitive dependencies.
+on:
+  push:
+    branches: [master, main]
+
+permissions:
+  contents: write
+
+jobs:
+  dependency-submission:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout at v7
+
+      - name: Set up Java
+        uses: actions/setup-java at v5
+        with:
+          distribution: temurin
+          java-version: 24
+
+      - name: Submit dependency graph
+        uses: gradle/actions/dependency-submission at v6


=====================================
.github/workflows/release.yml
=====================================
@@ -0,0 +1,101 @@
+name: Release
+
+on:
+  workflow_dispatch:
+    inputs:
+      version:
+        description: 'Release version (e.g., 1.13.0)'
+        required: true
+        type: string
+
+jobs:
+  release:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: write
+    steps:
+      - name: Checkout
+        uses: actions/checkout at v7
+        with:
+          persist-credentials: true
+          fetch-depth: 0
+
+      - name: Configure Git
+        run: |
+          git config user.name "github-actions[bot]"
+          git config user.email "github-actions[bot]@users.noreply.github.com"
+
+      - name: Set up Java
+        uses: actions/setup-java at v5
+        with:
+          distribution: temurin
+          java-version: 24
+
+      - name: Set up Gradle
+        uses: gradle/actions/setup-gradle at v6
+
+      - name: Set release version
+        run: |
+          sed -i 's/^version = "[^"]*"/version = "${{ inputs.version }}"/' build.gradle.kts
+          echo "Releasing version:"
+          grep '^version = ' build.gradle.kts
+
+      - name: Update version in README
+        run: |
+          # Gradle coordinate snippet: org.zeroturnaround:zt-exec:VERSION
+          perl -0pi -e 's/(org\.zeroturnaround:zt-exec:)[0-9][^"\)\s]*/${1}${{ inputs.version }}/g' README.md
+          # Maven coordinate snippet: <artifactId>zt-exec</artifactId> ... <version>VERSION</version>
+          perl -0pi -e 's{(<artifactId>zt-exec</artifactId>\s*<version>)[^<]+}{${1}${{ inputs.version }}}g' README.md
+
+      - name: Promote changelog Unreleased section
+        run: bash .github/scripts/prepare-changelog-release.sh "${{ inputs.version }}"
+
+      - name: Run full build (validates everything compiles + tests pass)
+        run: ./gradlew clean build
+
+      - name: Publish to Maven Central
+        run: ./gradlew publishAndReleaseToMavenCentral
+        env:
+          ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
+          ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
+          ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
+          ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
+
+      - name: Commit version bump
+        run: |
+          git add build.gradle.kts README.md CHANGELOG.md
+          git commit -m "Release ${{ inputs.version }}"
+
+      - name: Tag and push
+        run: |
+          git tag "v${{ inputs.version }}"
+          git push origin HEAD
+          git push origin "v${{ inputs.version }}"
+
+      - name: Create GitHub Release
+        env:
+          GH_TOKEN: ${{ github.token }}
+        run: |
+          gh release create "v${{ inputs.version }}" \
+            --title "v${{ inputs.version }}" \
+            --generate-notes \
+            build/libs/*.jar
+
+      - name: Set next development version
+        run: |
+          VERSION="${{ inputs.version }}"
+          # Increment the last numeric component to the next patch development
+          # version (1.13.0 -> 1.13.1); bump the minor or major by hand when needed.
+          PREFIX="${VERSION%.*}"
+          LAST="${VERSION##*.}"
+          if [ "$PREFIX" = "$VERSION" ]; then
+            NEXT="$((LAST + 1))-SNAPSHOT"
+          else
+            NEXT="${PREFIX}.$((LAST + 1))-SNAPSHOT"
+          fi
+          echo "Next development version: $NEXT"
+          sed -i "s/^version = \"$VERSION\"/version = \"$NEXT\"/" build.gradle.kts
+          grep '^version = ' build.gradle.kts
+          git add build.gradle.kts
+          git commit -m "Set next development version $NEXT"
+          git push origin HEAD


=====================================
.gitignore
=====================================
@@ -1,17 +1,19 @@
-.classpath
-.hg/
-.hgignore
-.hgtags
-.project
-.settings/
+bin/
+build/
+.gradle/
+# The forked-process tests mirror their classpath into target/test-classes.
 target/
 test.log
-.swp
-
-.idea
+writeLoop.data
+*.swp
 *.iml
 *.ipr
 *.iws
-
-writeLoop.data
+.classpath
+.project
+.settings/
+.idea
+.sonar
+release.sh
+rebel.xml
 src/main/resources/rebel.xml


=====================================
.mvn/wrapper/MavenWrapperDownloader.java deleted
=====================================
@@ -1,110 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
-*/
-
-import java.net.*;
-import java.io.*;
-import java.nio.channels.*;
-import java.util.Properties;
-
-public class MavenWrapperDownloader {
-
-    /**
-     * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
-     */
-    private static final String DEFAULT_DOWNLOAD_URL =
-            "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar";
-
-    /**
-     * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
-     * use instead of the default one.
-     */
-    private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
-            ".mvn/wrapper/maven-wrapper.properties";
-
-    /**
-     * Path where the maven-wrapper.jar will be saved to.
-     */
-    private static final String MAVEN_WRAPPER_JAR_PATH =
-            ".mvn/wrapper/maven-wrapper.jar";
-
-    /**
-     * Name of the property which should be used to override the default download url for the wrapper.
-     */
-    private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
-
-    public static void main(String args[]) {
-        System.out.println("- Downloader started");
-        File baseDirectory = new File(args[0]);
-        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
-
-        // If the maven-wrapper.properties exists, read it and check if it contains a custom
-        // wrapperUrl parameter.
-        File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
-        String url = DEFAULT_DOWNLOAD_URL;
-        if(mavenWrapperPropertyFile.exists()) {
-            FileInputStream mavenWrapperPropertyFileInputStream = null;
-            try {
-                mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
-                Properties mavenWrapperProperties = new Properties();
-                mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
-                url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
-            } catch (IOException e) {
-                System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
-            } finally {
-                try {
-                    if(mavenWrapperPropertyFileInputStream != null) {
-                        mavenWrapperPropertyFileInputStream.close();
-                    }
-                } catch (IOException e) {
-                    // Ignore ...
-                }
-            }
-        }
-        System.out.println("- Downloading from: : " + url);
-
-        File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
-        if(!outputFile.getParentFile().exists()) {
-            if(!outputFile.getParentFile().mkdirs()) {
-                System.out.println(
-                        "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
-            }
-        }
-        System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
-        try {
-            downloadFileFromURL(url, outputFile);
-            System.out.println("Done");
-            System.exit(0);
-        } catch (Throwable e) {
-            System.out.println("- Error downloading");
-            e.printStackTrace();
-            System.exit(1);
-        }
-    }
-
-    private static void downloadFileFromURL(String urlString, File destination) throws Exception {
-        URL website = new URL(urlString);
-        ReadableByteChannel rbc;
-        rbc = Channels.newChannel(website.openStream());
-        FileOutputStream fos = new FileOutputStream(destination);
-        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
-        fos.close();
-        rbc.close();
-    }
-
-}


=====================================
.mvn/wrapper/maven-wrapper.properties deleted
=====================================
@@ -1 +0,0 @@
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
\ No newline at end of file


=====================================
.travis.yml deleted
=====================================
@@ -1,4 +0,0 @@
-language: java
-jdk:
-  - oraclejdk8
-  - oraclejdk9


=====================================
CHANGELOG.md
=====================================
@@ -0,0 +1,142 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]
+
+## [1.13.0] - 2026-07-10
+
+### Added
+
+- `LogOutputStream.create(LineConsumer)` to build a `LogOutputStream` from a lambda ([#107](https://github.com/zeroturnaround/zt-exec/pull/107)).
+- `LogOutputStream.setOutputCharset(String)` to control the charset used to decode the process output ([#89](https://github.com/zeroturnaround/zt-exec/pull/89)).
+- An OSGi bundle manifest (`Bundle-SymbolicName`, `Export-Package`) in the published jar ([#85](https://github.com/zeroturnaround/zt-exec/pull/85)).
+- A JPMS module descriptor for module `org.zeroturnaround.exec`, shipped as a Java 9 multi-release entry ([#106](https://github.com/zeroturnaround/zt-exec/pull/106)).
+
+### Changed
+
+- Raised the minimum Java runtime from 6 to 8 (bytecode target moved from 1.6 to 1.8).
+- Upgraded the `slf4j-api` dependency from 1.7.2 to 1.7.32.
+- Migrated the build from Maven to Gradle; releases now publish to Maven Central through the Sonatype Central Portal.
+
+## [1.12] - 2020-09-02
+
+### Removed
+
+- `rebel.xml` from the release archive.
+
+## [1.11] - 2019-07-05
+
+### Changed
+
+- Improved usage — eliminated cases of "log and throw".
+- Use ping instead of sleep on Windows to test timeout exceptions.
+
+### Removed
+
+- Dependency on Apache Commons IO.
+
+### Fixed
+
+- Various bug fixes.
+
+## [1.10] - 2017-08-01
+
+### Added
+
+- Support for flushing output after each write.
+- Hooks for thread executor creation.
+- Support for preserving the MDC context of the caller thread.
+
+### Changed
+
+- `LogOutputStream` handles line breaks like `ProcessOutput`.
+
+## [1.9] - 2016-04-12
+
+### Added
+
+- `ProcessInitException` to expose the error code.
+- `ProcessExecutor.checkExitValue()` for unit testing.
+- Getters to `ProcessExecutor`.
+
+### Fixed
+
+- Using empty arguments on Windows.
+- Closing stdin on Java 8.
+- Redirecting `PipedInputStream`.
+
+## [1.8] - 2015-03-17
+
+### Added
+
+- `ProcessExecutor.closeTimeout()`.
+- `ProcessOutput.getLines()`.
+- `ProcessOutput.command(Iterable)`.
+- `ProcessListener.afterFinish()` and `InvalidOutputException` support.
+- `Level` class.
+
+### Changed
+
+- Improved `Slf4jStream`.
+- Improved the `TimeoutException` message.
+
+### Fixed
+
+- Blocking JVM shutdown.
+
+## [1.7] - 2014-06-30
+
+### Added
+
+- `ProcessExecutor.stopper(ProcessStopper)` to customize stopping on timeout or cancellation.
+- `ProcessExecutor.setMessageLogger()` to customize the log message level.
+- `ProcessExecutor.executeNoTimeout()` to avoid catching `TimeoutException`.
+- `ProcessExecutor.environment(String, String)` for convenience.
+- get-prefixed `StartedProcess` methods (the old ones are deprecated).
+
+### Changed
+
+- Improved logging and error handling.
+
+### Fixed
+
+- `ProcessExecutor.commandSplit()`.
+
+## [1.6] - 2014-01-30
+
+### Added
+
+- `ProcessExecutor.redirectInput()`.
+- get-prefixed variants of some methods (the old ones are deprecated).
+
+### Changed
+
+- Improved SLF4J logging support.
+- Improved adding and removing destroyers and listeners.
+- `InvalidExitValueException` now includes the process output when it was read.
+
+## [1.5] - 2013-10-14
+
+### Changed
+
+- Any exit code is now allowed by default (use `exitValueNormal()` to allow only zero).
+
+### Fixed
+
+- Starting processes on JVM shutdown.
+- Supporting Java 1.5.
+
+[Unreleased]: https://github.com/zeroturnaround/zt-exec/compare/v1.13.0...HEAD
+[1.13.0]: https://github.com/zeroturnaround/zt-exec/compare/zt-exec-1.12...v1.13.0
+[1.12]: https://github.com/zeroturnaround/zt-exec/compare/zt-exec-1.11...zt-exec-1.12
+[1.11]: https://github.com/zeroturnaround/zt-exec/compare/zt-exec-1.10...zt-exec-1.11
+[1.10]: https://github.com/zeroturnaround/zt-exec/compare/zt-exec-1.9...zt-exec-1.10
+[1.9]: https://github.com/zeroturnaround/zt-exec/compare/zt-exec-1.8...zt-exec-1.9
+[1.8]: https://github.com/zeroturnaround/zt-exec/compare/zt-exec-1.7...zt-exec-1.8
+[1.7]: https://github.com/zeroturnaround/zt-exec/compare/zt-exec-1.6...zt-exec-1.7
+[1.6]: https://github.com/zeroturnaround/zt-exec/compare/zt-exec-1.5...zt-exec-1.6
+[1.5]: https://github.com/zeroturnaround/zt-exec/releases/tag/zt-exec-1.5


=====================================
Changelog.txt deleted
=====================================
@@ -1,57 +0,0 @@
-********************************************
-  ZT Exec Changelog
-********************************************
-
-1.12 (2nd of September 2020)
-* Removed rebel.xml from the release archive
-
-1.11 (5th of July 2019)
-* Improved usage - eliminated cases of log and throw
-* Removed dependency on Apache's commons-io library
-* Use ping instead of sleep on Windows to test timeout exceptions
-* Some bug fixes
-
-1.10 (1st August 2017)
-* Added support for flushing output after each write
-* Added support for hooks for thread executor creation
-* Added support of preserving MDC context of the caller thread
-* Changed LogOutpuStream to handle line breaks like ProcessOutput
-
-1.9 (12th April 2016)
-* Fixed using empty arguments on Windows
-* Fixed closing stdin on Java 8
-* Fixed redirecting PipedInputStream.
-* Added ProcessInitException to expose error code
-* Added ProcessExecutor.checkExitValue() for unit testing
-* Added getters to ProcessExecutor
-
-1.8 (17th March 2015)
-* Fixed blocking JVM shutdown
-* Improved TimeoutException message
-* Improved Slf4jStream
-* Added ProcessExecutor.closeTimeout()
-* Added ProcessOutput.getLines()
-* Added ProcessOutput.command(Iterable)
-* Added ProcessListener.afterFinish() and InvalidOutputException support
-* Added Level class
-
-1.7 (30th June 2014)
-* Fixed ProcessExecutor.commandSplit()
-* Added ProcessExecutor.stopper(ProcessStopper) to customize stopping in case of timeout or cancellation
-* Added ProcessExecutor.setMessageLogger() to customize log message level
-* Added ProcessExecutor.executeNoTimeout() to avoid catching TimeoutException
-* Added ProcessExecutor.environment(String, String) for convenience
-* Improved logging and error handling
-* Added get-prefixes to StartedProcess methods (old ones are deprecated)
-
-1.6 (30th January 2014)
-* Improved Slf4j logging support
-* Added ProcessExecutor.redirectInput()
-* Improved adding/removing destroyers and listeners
-* InvalidExitValueException now includes process output if it was read
-* Added get-prefixes to some methods (old ones are deprecated)
-
-1.5 (14th October 2013)
-* By default any exit code is now allowed (use exitValueNormal() to only allow zero)
-* Fixed an issue with starting processes on JVM shutdown
-* Fixed an issue with supporting Java 1.5


=====================================
README.md
=====================================
@@ -2,7 +2,7 @@ ZT Process Executor
 ================
 
 ### Continuous Integration
-[![Build Status](https://travis-ci.org/zeroturnaround/zt-exec.png)](https://travis-ci.org/zeroturnaround/zt-exec)
+[![Build](https://github.com/zeroturnaround/zt-exec/actions/workflows/build.yml/badge.svg)](https://github.com/zeroturnaround/zt-exec/actions/workflows/build.yml)
 
 ### Quick Overview
 
@@ -10,21 +10,30 @@ The project was created to merge similar functionality of projects at [ZeroTurna
 It's designed to be powerful but still simple to use. By using a single class **ProcessExecutor**
 the user gets the functionality from both **java.lang.ProcessBuilder** and [Apache Commons Exec](http://commons.apache.org/proper/commons-exec/).
 
+### Dependencies
+
+* Minimal required Java version is 8.
+* The only 3rd-party dependency is [SLF4J](https://www.slf4j.org/).
+
 ### Installation
-[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.zeroturnaround/zt-exec/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.zeroturnaround/zt-exec)
+[![Maven Central](https://img.shields.io/maven-central/v/org.zeroturnaround/zt-exec.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/org.zeroturnaround/zt-exec)
 
-The project artifacts are available in [Maven Central Repository](https://search.maven.org/artifact/org.zeroturnaround/zt-exec/).
+The project artifacts are available in [Maven Central Repository](https://central.sonatype.com/artifact/org.zeroturnaround/zt-exec).
 
-To include it in your maven project then you have to specify the dependency.
+Maven:
 
 ```xml
-...
 <dependency>
     <groupId>org.zeroturnaround</groupId>
     <artifactId>zt-exec</artifactId>
-    <version>1.11</version>
+    <version>1.13.0</version>
 </dependency>
-...
+```
+
+Gradle:
+
+```kotlin
+implementation("org.zeroturnaround:zt-exec:1.13.0")
 ```
 
 ## Motivation
@@ -155,7 +164,17 @@ new ProcessExecutor().command("java", "-version")
 
 <hr/>
 
-* Handling output line-by-line while process is running
+* Handling output line-by-line while process is running (Java 8+)
+
+```java
+new ProcessExecutor().command("java", "-version")
+    .redirectOutput(line -> ...)
+    .execute();
+```
+
+<hr/>
+
+* Handling output line-by-line while process is running (prior to Java 8)
 
 ```java
 new ProcessExecutor().command("java", "-version")
@@ -260,3 +279,31 @@ Future<ProcessResult> future = new ProcessExecutor()
 String output = future.get(60, TimeUnit.SECONDS).outputUTF8();
 ```
 
+## Building
+
+The project is built with [Gradle](https://gradle.org/) via the bundled wrapper, so no local
+Gradle installation is required:
+
+```sh
+./gradlew build
+```
+
+The main classes target Java 8 bytecode; the JPMS `module-info` for `org.zeroturnaround.exec`
+is shipped as a Java 9 multi-release entry. The build resolves the required Java toolchain
+automatically (it is downloaded on demand if not already installed), so the build itself runs
+on any modern JDK.
+
+## Releasing
+
+Versions follow [Semantic Versioning](https://semver.org/) (`MAJOR.MINOR.PATCH`, e.g. `1.13.0`)
+and release tags use the `vMAJOR.MINOR.PATCH` form (e.g. `v1.13.0`). Tags created before this
+convention use the older `zt-exec-<version>` form.
+
+Releases are cut with the **Release** GitHub Actions workflow (Actions → Release → Run workflow).
+It takes the release version (e.g. `1.13.0`) and then builds, publishes to Maven Central, tags
+the commit, creates the GitHub release, and sets the next development version.
+
+The workflow also promotes the `## [Unreleased]` section of [CHANGELOG.md](CHANGELOG.md) into a
+dated `## [x.y.z]` section and updates the comparison links, so the only changelog task is to make
+sure the changes being released are listed under `## [Unreleased]` beforehand. (The release fails
+if that section is empty.)


=====================================
build.gradle.kts
=====================================
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2013 ZeroTurnaround <support at zeroturnaround.com>
+ * Copyright (C) 2026 Neeme Praks
+ * Contains fragments of code from Apache Commons Exec, rights owned
+ * by Apache Software Foundation (ASF).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import aQute.bnd.gradle.BundleTaskExtension
+import org.gradle.process.CommandLineArgumentProvider
+
+plugins {
+  // java-library (not plain java) so slf4j-api can be an `api` dependency: it is
+  // part of the public API (ProcessExecutor.info(org.slf4j.Logger), etc.) and
+  // must land at compile scope in the published POM.
+  `java-library`
+  alias(libs.plugins.maven.publish)
+  alias(libs.plugins.bnd)
+}
+
+group = "org.zeroturnaround"
+version = "1.13.0"
+description = "A lightweight library to execute external processes from Java."
+
+val moduleName = "org.zeroturnaround.exec"
+
+repositories {
+  mavenCentral()
+}
+
+java {
+  // The main classes target Java 8 bytecode (slf4j 1.7 supports Java 8 and the
+  // library uses no newer API), keeping pre-9 consumers working. The JPMS
+  // module-info is shipped separately as a Java 9 multi-release entry (see below).
+  // A toolchain is pinned (rather than the Java 8 floor) because compiling
+  // module-info requires a JDK 9+ compiler; it is auto-provisioned via the foojay
+  // resolver in settings.gradle.kts when not already installed.
+  toolchain {
+    languageVersion.set(JavaLanguageVersion.of(21))
+  }
+}
+
+dependencies {
+  // slf4j-api is part of the public API, so it is an `api` dependency: it appears
+  // at compile scope in the POM and on consumers' compile classpath.
+  api(libs.slf4j.api)
+
+  testImplementation(libs.junit)
+  testImplementation(libs.logback.classic)
+  testImplementation(libs.commons.lang3)
+  testImplementation(libs.commons.io)
+}
+
+tasks.withType<JavaCompile>().configureEach {
+  options.encoding = "UTF-8"
+}
+
+tasks.named<JavaCompile>("compileJava") {
+  options.release.set(8)
+}
+
+// The JPMS descriptor lives in its own source set and is compiled as Java 9
+// bytecode. It exports packages that live in the main source set, so the main
+// classes are patched into the module and the API dependencies are put on the
+// module path for the `requires` clauses to resolve.
+sourceSets {
+  create("moduleInfo") {
+    java.srcDir("src/moduleInfo/java")
+  }
+}
+
+val main = sourceSets.main.get()
+
+// Supplies the module-info compile with the main classes (patched into the module
+// so the exported packages resolve) and the API dependencies (on the module path so
+// `requires` resolves). A managed type rather than a doFirst/closure so the inputs
+// are tracked and the task stays configuration-cache compatible.
+abstract class ModuleInfoCompileArgs : CommandLineArgumentProvider {
+  @get:Input
+  abstract val moduleName: Property<String>
+
+  @get:CompileClasspath
+  abstract val modulePath: ConfigurableFileCollection
+
+  @get:Classpath
+  abstract val patchModuleClasses: ConfigurableFileCollection
+
+  override fun asArguments(): Iterable<String> = listOf(
+    "--module-path", modulePath.asPath,
+    "--patch-module", "${moduleName.get()}=${patchModuleClasses.asPath}",
+  )
+}
+
+val execModuleName = moduleName
+tasks.named<JavaCompile>("compileModuleInfoJava") {
+  dependsOn(tasks.named("compileJava"))
+  options.release.set(9)
+  classpath = files()
+  options.compilerArgumentProviders.add(
+    objects.newInstance(ModuleInfoCompileArgs::class).apply {
+      moduleName.set(execModuleName)
+      modulePath.from(main.compileClasspath)
+      patchModuleClasses.from(main.output.classesDirs)
+    },
+  )
+}
+
+tasks.jar {
+  // Match the historical Maven build: no generated Maven descriptor in the jar.
+  manifest {
+    attributes(
+      "Implementation-Title" to project.name,
+      "Implementation-Version" to project.version,
+      "Multi-Release" to "true",
+    )
+  }
+  // Ship module-info.class as a Java 9 multi-release entry so the jar stays a
+  // plain classpath jar on Java 8 and becomes a named module on Java 9+.
+  into("META-INF/versions/9") {
+    from(sourceSets["moduleInfo"].output)
+  }
+  // Produce the OSGi bundle manifest (Bundle-SymbolicName, Export-Package, and
+  // the computed Import-Package) with bnd, reproducing the bnd-maven-plugin setup.
+  val bundle = extensions.getByType<BundleTaskExtension>()
+  bundle.setBnd(
+    """
+    Bundle-SymbolicName: org.zeroturnaround.zt-exec
+    Export-Package: org.zeroturnaround.exec.*
+    -exportcontents: org.zeroturnaround.exec.*
+    """.trimIndent(),
+  )
+  bundle.classpath(main.compileClasspath)
+}
+
+// The Javadoc predates the strict doclint in JDK 8+; don't fail the build on it.
+tasks.withType<Javadoc>().configureEach {
+  (options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet")
+}
+
+// Several tests fork `java -cp target/test-classes <HelperClass>` and one runs in
+// `new File("target")`, i.e. the layout the Maven build produced. Mirror the
+// compiled test classes (and resources) there so the tests run unmodified.
+val syncForkedProcessClasspath by tasks.registering(Sync::class) {
+  from(sourceSets.test.get().output)
+  into(layout.projectDirectory.dir("target/test-classes"))
+}
+
+tasks.withType<Test>().configureEach {
+  dependsOn(syncForkedProcessClasspath)
+  // The test sources are JUnit 4; Gradle picks JUnit 4 up automatically from the
+  // test classpath, so no useJUnitPlatform() here.
+  testLogging {
+    events("passed", "skipped", "failed")
+  }
+}
+
+// Sign only when in-memory keys are provided (CI release). Local builds skip signing.
+tasks.withType<Sign>().configureEach {
+  enabled = project.findProperty("signingInMemoryKey") != null
+}
+
+mavenPublishing {
+  // The release workflow invokes `publishAndReleaseToMavenCentral`, which both
+  // uploads and releases; no need to also auto-release from the plain task.
+  publishToMavenCentral()
+  signAllPublications()
+
+  coordinates(group.toString(), "zt-exec", version.toString())
+
+  pom {
+    name.set("ZT Process Executor")
+    description.set(project.description)
+    url.set("https://github.com/zeroturnaround/zt-exec")
+    licenses {
+      license {
+        name.set("The Apache Software License, Version 2.0")
+        url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
+        comments.set("A business-friendly OSS license")
+      }
+    }
+    developers {
+      developer {
+        id.set("nemecec")
+        name.set("Neeme Praks")
+        email.set("neeme at praks.net")
+        url.set("https://github.com/nemecec")
+      }
+      developer {
+        id.set("rein")
+        name.set("Rein")
+      }
+      developer {
+        id.set("toomasr")
+        name.set("Toomas")
+      }
+    }
+    scm {
+      url.set("https://github.com/zeroturnaround/zt-exec")
+      connection.set("scm:git:git://github.com/zeroturnaround/zt-exec.git")
+      developerConnection.set("scm:git:ssh://git@github.com/zeroturnaround/zt-exec.git")
+    }
+  }
+}


=====================================
get_release_commands.sh deleted
=====================================
@@ -1,84 +0,0 @@
-#!/bin/sh
-
-
-if [[ "$1" = "-h" ]] || [[ "$1" = "--help" ]]; then
-  echo "Usage: './get_release_commands.sh VERSION_TO_RELEASE [NEW_DEV_VERSION]'"
-  echo "Prints out commands to run to release zt-exec to Maven Central."
-  echo "VERSION_TO_RELEASE must be a number (integer or floating). NEW_DEV_VERSION is optional"
-  exit 0
-fi
-
-if ! [[ "$1" =~ ^[0-9]*\.?[0-9]*$ ]] || [[ "$1z" = "z" ]]; then
-  echo "Not a valid version number given, use -h to get usage options"
-  exit 1
-fi
-
-version=$1
-
-version_after_dot=${version##*.}
-version_str_length=${#version}-${#version_after_dot}
-
-incr_last_digit=$((${version_after_dot}+1))
-
-version_without_last_digit=${version: 0:${version_str_length}}
-new_version="${version_without_last_digit}${incr_last_digit}-SNAPSHOT"
-
-if [[ "$2z" = "z" ]]; then
-  echo "No new development version given using ${new_version}"
-else
-  new_version=$2
-  echo "New development version will be ${new_version}"
-fi
-
-echo "To release zt-exec version ${version} run these commands:"
-echo ""
-echo "1) set release version"
-echo "mvn versions:set -DnewVersion=${version}"
-
-echo ""
-echo "2) commit & tag"
-echo "git add pom.xml; "
-echo "git commit -m \"Prepare release zt-exec-${version}\""
-echo "git tag zt-exec-${version}"
-
-echo ""
-echo "3) build release"
-echo "mvn clean install"
-
-echo ""
-echo "4) generate javadoc archive"
-echo "mvn javadoc:jar"
-
-echo ""
-echo "5) generate sources archive"
-echo "mvn source:jar"
-
-echo ""
-echo "6) deploy and sign releases archive"
-echo "mvn gpg:sign-and-deploy-file -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile=pom.xml -Dfile=target/zt-exec-$1.jar"
-
-echo ""
-echo "7) deploy and sign sources archive"
-echo "mvn gpg:sign-and-deploy-file -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile=pom.xml -Dfile=target/zt-exec-$1-sources.jar -Dclassifier=sources"
-
-echo ""
-echo "8) deploy and sign javadoc archive"
-echo "mvn gpg:sign-and-deploy-file -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile=pom.xml -Dfile=target/zt-exec-$1-javadoc.jar -Dclassifier=javadoc"
-
-echo ""
-echo "9) set new development version"
-echo "mvn versions:set -DnewVersion=${new_version}"
-echo "git add pom.xml; "
-echo "git commit -m \"prepare for next development iteration\""
-
-echo ""
-echo "10) push to GitHub"
-echo "git push"
-echo "git push --tags"
-
-echo ""
-echo "11) clean local repo"
-echo "git clean -f"
-
-
-


=====================================
gradle/libs.versions.toml
=====================================
@@ -0,0 +1,19 @@
+[versions]
+slf4j = "1.7.32"
+junit = "4.13.2"
+logback = "1.5.38"
+commons-lang3 = "3.20.0"
+commons-io = "2.22.0"
+maven-publish = "0.37.0"
+bnd = "7.3.0"
+
+[libraries]
+slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
+junit = { module = "junit:junit", version.ref = "junit" }
+logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
+commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commons-lang3" }
+commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" }
+
+[plugins]
+maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" }
+bnd = { id = "biz.aQute.bnd.builder", version.ref = "bnd" }


=====================================
mvnw deleted
=====================================
@@ -1,286 +0,0 @@
-#!/bin/sh
-# ----------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Maven2 Start Up Batch script
-#
-# Required ENV vars:
-# ------------------
-#   JAVA_HOME - location of a JDK home dir
-#
-# Optional ENV vars
-# -----------------
-#   M2_HOME - location of maven2's installed home dir
-#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
-#     e.g. to debug Maven itself, use
-#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-# ----------------------------------------------------------------------------
-
-if [ -z "$MAVEN_SKIP_RC" ] ; then
-
-  if [ -f /etc/mavenrc ] ; then
-    . /etc/mavenrc
-  fi
-
-  if [ -f "$HOME/.mavenrc" ] ; then
-    . "$HOME/.mavenrc"
-  fi
-
-fi
-
-# OS specific support.  $var _must_ be set to either true or false.
-cygwin=false;
-darwin=false;
-mingw=false
-case "`uname`" in
-  CYGWIN*) cygwin=true ;;
-  MINGW*) mingw=true;;
-  Darwin*) darwin=true
-    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
-    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
-    if [ -z "$JAVA_HOME" ]; then
-      if [ -x "/usr/libexec/java_home" ]; then
-        export JAVA_HOME="`/usr/libexec/java_home`"
-      else
-        export JAVA_HOME="/Library/Java/Home"
-      fi
-    fi
-    ;;
-esac
-
-if [ -z "$JAVA_HOME" ] ; then
-  if [ -r /etc/gentoo-release ] ; then
-    JAVA_HOME=`java-config --jre-home`
-  fi
-fi
-
-if [ -z "$M2_HOME" ] ; then
-  ## resolve links - $0 may be a link to maven's home
-  PRG="$0"
-
-  # need this for relative symlinks
-  while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
-    if expr "$link" : '/.*' > /dev/null; then
-      PRG="$link"
-    else
-      PRG="`dirname "$PRG"`/$link"
-    fi
-  done
-
-  saveddir=`pwd`
-
-  M2_HOME=`dirname "$PRG"`/..
-
-  # make it fully qualified
-  M2_HOME=`cd "$M2_HOME" && pwd`
-
-  cd "$saveddir"
-  # echo Using m2 at $M2_HOME
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
-  [ -n "$M2_HOME" ] &&
-    M2_HOME=`cygpath --unix "$M2_HOME"`
-  [ -n "$JAVA_HOME" ] &&
-    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-  [ -n "$CLASSPATH" ] &&
-    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
-fi
-
-# For Mingw, ensure paths are in UNIX format before anything is touched
-if $mingw ; then
-  [ -n "$M2_HOME" ] &&
-    M2_HOME="`(cd "$M2_HOME"; pwd)`"
-  [ -n "$JAVA_HOME" ] &&
-    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
-  # TODO classpath?
-fi
-
-if [ -z "$JAVA_HOME" ]; then
-  javaExecutable="`which javac`"
-  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
-    # readlink(1) is not available as standard on Solaris 10.
-    readLink=`which readlink`
-    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
-      if $darwin ; then
-        javaHome="`dirname \"$javaExecutable\"`"
-        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
-      else
-        javaExecutable="`readlink -f \"$javaExecutable\"`"
-      fi
-      javaHome="`dirname \"$javaExecutable\"`"
-      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
-      JAVA_HOME="$javaHome"
-      export JAVA_HOME
-    fi
-  fi
-fi
-
-if [ -z "$JAVACMD" ] ; then
-  if [ -n "$JAVA_HOME"  ] ; then
-    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
-      # IBM's JDK on AIX uses strange locations for the executables
-      JAVACMD="$JAVA_HOME/jre/sh/java"
-    else
-      JAVACMD="$JAVA_HOME/bin/java"
-    fi
-  else
-    JAVACMD="`which java`"
-  fi
-fi
-
-if [ ! -x "$JAVACMD" ] ; then
-  echo "Error: JAVA_HOME is not defined correctly." >&2
-  echo "  We cannot execute $JAVACMD" >&2
-  exit 1
-fi
-
-if [ -z "$JAVA_HOME" ] ; then
-  echo "Warning: JAVA_HOME environment variable is not set."
-fi
-
-CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
-# traverses directory structure from process work directory to filesystem root
-# first directory with .mvn subdirectory is considered project base directory
-find_maven_basedir() {
-
-  if [ -z "$1" ]
-  then
-    echo "Path not specified to find_maven_basedir"
-    return 1
-  fi
-
-  basedir="$1"
-  wdir="$1"
-  while [ "$wdir" != '/' ] ; do
-    if [ -d "$wdir"/.mvn ] ; then
-      basedir=$wdir
-      break
-    fi
-    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
-    if [ -d "${wdir}" ]; then
-      wdir=`cd "$wdir/.."; pwd`
-    fi
-    # end of workaround
-  done
-  echo "${basedir}"
-}
-
-# concatenates all lines of a file
-concat_lines() {
-  if [ -f "$1" ]; then
-    echo "$(tr -s '\n' ' ' < "$1")"
-  fi
-}
-
-BASE_DIR=`find_maven_basedir "$(pwd)"`
-if [ -z "$BASE_DIR" ]; then
-  exit 1;
-fi
-
-##########################################################################################
-# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-# This allows using the maven wrapper in projects that prohibit checking in binary data.
-##########################################################################################
-if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
-    if [ "$MVNW_VERBOSE" = true ]; then
-      echo "Found .mvn/wrapper/maven-wrapper.jar"
-    fi
-else
-    if [ "$MVNW_VERBOSE" = true ]; then
-      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
-    fi
-    jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"
-    while IFS="=" read key value; do
-      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
-      esac
-    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
-    if [ "$MVNW_VERBOSE" = true ]; then
-      echo "Downloading from: $jarUrl"
-    fi
-    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
-
-    if command -v wget > /dev/null; then
-        if [ "$MVNW_VERBOSE" = true ]; then
-          echo "Found wget ... using wget"
-        fi
-        wget "$jarUrl" -O "$wrapperJarPath"
-    elif command -v curl > /dev/null; then
-        if [ "$MVNW_VERBOSE" = true ]; then
-          echo "Found curl ... using curl"
-        fi
-        curl -o "$wrapperJarPath" "$jarUrl"
-    else
-        if [ "$MVNW_VERBOSE" = true ]; then
-          echo "Falling back to using Java to download"
-        fi
-        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
-        if [ -e "$javaClass" ]; then
-            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
-                if [ "$MVNW_VERBOSE" = true ]; then
-                  echo " - Compiling MavenWrapperDownloader.java ..."
-                fi
-                # Compiling the Java class
-                ("$JAVA_HOME/bin/javac" "$javaClass")
-            fi
-            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
-                # Running the downloader
-                if [ "$MVNW_VERBOSE" = true ]; then
-                  echo " - Running MavenWrapperDownloader.java ..."
-                fi
-                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
-            fi
-        fi
-    fi
-fi
-##########################################################################################
-# End of extension
-##########################################################################################
-
-export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
-if [ "$MVNW_VERBOSE" = true ]; then
-  echo $MAVEN_PROJECTBASEDIR
-fi
-MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
-  [ -n "$M2_HOME" ] &&
-    M2_HOME=`cygpath --path --windows "$M2_HOME"`
-  [ -n "$JAVA_HOME" ] &&
-    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
-  [ -n "$CLASSPATH" ] &&
-    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
-  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
-    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
-fi
-
-WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-exec "$JAVACMD" \
-  $MAVEN_OPTS \
-  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
-  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
-  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"


=====================================
mvnw.cmd deleted
=====================================
@@ -1,161 +0,0 @@
- at REM ----------------------------------------------------------------------------
- at REM Licensed to the Apache Software Foundation (ASF) under one
- at REM or more contributor license agreements.  See the NOTICE file
- at REM distributed with this work for additional information
- at REM regarding copyright ownership.  The ASF licenses this file
- at REM to you under the Apache License, Version 2.0 (the
- at REM "License"); you may not use this file except in compliance
- at REM with the License.  You may obtain a copy of the License at
- at REM
- at REM    http://www.apache.org/licenses/LICENSE-2.0
- at REM
- at REM Unless required by applicable law or agreed to in writing,
- at REM software distributed under the License is distributed on an
- at REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- at REM KIND, either express or implied.  See the License for the
- at REM specific language governing permissions and limitations
- at REM under the License.
- at REM ----------------------------------------------------------------------------
-
- at REM ----------------------------------------------------------------------------
- at REM Maven2 Start Up Batch script
- at REM
- at REM Required ENV vars:
- at REM JAVA_HOME - location of a JDK home dir
- at REM
- at REM Optional ENV vars
- at REM M2_HOME - location of maven2's installed home dir
- at REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
- at REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
- at REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
- at REM     e.g. to debug Maven itself, use
- at REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
- at REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
- at REM ----------------------------------------------------------------------------
-
- at REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
- at echo off
- at REM set title of command window
-title %0
- at REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
- at if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
-
- at REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
- at REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
- at REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
-if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
-:skipRcPre
-
- at setlocal
-
-set ERROR_CODE=0
-
- at REM To isolate internal variables from possible post scripts, we use another setlocal
- at setlocal
-
- at REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
- at REM ==== END VALIDATION ====
-
-:init
-
- at REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
- at REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
- at setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
- at endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"
-FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
-	IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 
-)
-
- at REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
- at REM This allows using the maven wrapper in projects that prohibit checking in binary data.
-if exist %WRAPPER_JAR% (
-    echo Found %WRAPPER_JAR%
-) else (
-    echo Couldn't find %WRAPPER_JAR%, downloading it ...
-	echo Downloading from: %DOWNLOAD_URL%
-    powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
-    echo Finished downloading %WRAPPER_JAR%
-)
- at REM End of extension
-
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
- at endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
- at REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
-if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
-:skipRcPost
-
- at REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%" == "on" pause
-
-if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
-
-exit /B %ERROR_CODE%


=====================================
pom.xml deleted
=====================================
@@ -1,202 +0,0 @@
-<!-- Copyright (C) 2013 ZeroTurnaround <support at zeroturnaround.com> Contains
-  fragments of code from Apache Commons Exec, rights owned by Apache Software
-  Foundation (ASF). Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License. You may
-  obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-  Unless required by applicable law or agreed to in writing, software distributed
-  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
-  OR CONDITIONS OF ANY KIND, either express or implied. See the License for
-  the specific language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.zeroturnaround</groupId>
-  <artifactId>zt-exec</artifactId>
-  <packaging>jar</packaging>
-  <name>ZT Process Executor</name>
-  <version>1.12</version>
-
-  <scm>
-    <connection>scm:git:git at github.com:zeroturnaround/zt-exec.git</connection>
-    <url>scm:git:git at github.com:zeroturnaround/zt-exec.git</url>
-    <developerConnection>scm:git:git at github.com:zeroturnaround/zt-exec.git</developerConnection>
-  </scm>
-
-  <distributionManagement>
-    <repository>
-      <id>sonatype-nexus-staging</id>
-      <name>Sonatype OSS Staging</name>
-      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
-      <layout>default</layout>
-    </repository>
-    <snapshotRepository>
-      <id>sonatype-nexus-snapshots</id>
-      <name>Sonatype OSS Snapshots</name>
-      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
-      <layout>default</layout>
-    </snapshotRepository>
-  </distributionManagement>
-
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <version>1.7.2</version>
-    </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.11</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>ch.qos.logback</groupId>
-      <artifactId>logback-classic</artifactId>
-      <version>1.1.2</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
-      <version>3.5</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>2.5</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.5.1</version>
-        <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.3.1</version>
-        <configuration>
-          <archive>
-            <addMavenDescriptor>false</addMavenDescriptor>
-          </archive>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-javadoc-plugin</artifactId>
-        <version>3.0.1</version>
-        <executions>
-          <execution>
-            <id>attach-javadocs</id>
-            <goals>
-              <goal>jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-release-plugin</artifactId>
-        <version>2.5.3</version>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <version>3.0.0</version>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <goals>
-              <goal>jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-  <profiles>
-    <profile>
-      <id>release-sign-artifacts</id>
-      <activation>
-        <property>
-          <name>performRelease</name>
-          <value>true</value>
-        </property>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-release-plugin</artifactId>
-            <configuration>
-              <tagBase>https://svn.apache.org/repos/asf/maven/components/releases</tagBase>
-              <mavenExecutorId>forked-path</mavenExecutorId>
-            </configuration>
-          </plugin>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-gpg-plugin</artifactId>
-            <version>1.4</version>
-            <executions>
-              <execution>
-                <id>sign-artifacts</id>
-                <phase>verify</phase>
-                <goals>
-                  <goal>sign</goal>
-                </goals>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-
-  <organization>
-    <name>ZeroTurnaround</name>
-    <url>http://zeroturnaround.com/</url>
-  </organization>
-  <url>https://github.com/zeroturnaround/zt-exec</url>
-  <description>A lightweight library to execute external processes from Java.</description>
-
-  <developers>
-    <developer>
-      <id>rein</id>
-      <name>Rein</name>
-      <email>rein at zeroturnaround.com</email>
-      <url>http://www.linkedin.com/in/reinra</url>
-      <organization>ZeroTurnaround</organization>
-      <organizationUrl>http://zeroturnaround.com</organizationUrl>
-    </developer>
-    <developer>
-      <id>toomasr</id>
-      <name>Toomas</name>
-      <email>toomas at zeroturnaround.com</email>
-      <url>http://www.linkedin.com/in/toomasr</url>
-      <organization>ZeroTurnaround</organization>
-      <organizationUrl>http://zeroturnaround.com</organizationUrl>
-    </developer>
-  </developers>
-
-  <licenses>
-    <license>
-      <name>The Apache Software License, Version 2.0</name>
-      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
-      <comments>A business-friendly OSS license</comments>
-    </license>
-  </licenses>
-</project>


=====================================
settings.gradle.kts
=====================================
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2013 ZeroTurnaround <support at zeroturnaround.com>
+ * Copyright (C) 2026 Neeme Praks
+ * Contains fragments of code from Apache Commons Exec, rights owned
+ * by Apache Software Foundation (ASF).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+plugins {
+  // Auto-provisions the Java toolchain when it isn't already installed,
+  // so the build works on machines (and CI runners) that only ship a newer JDK.
+  id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
+}
+
+rootProject.name = "zt-exec"


=====================================
src/main/java/org/zeroturnaround/exec/ProcessExecutor.java
=====================================
@@ -136,8 +136,8 @@ public class ProcessExecutor {
     // Run in case of any constructor
     exitValues(DEFAULT_EXIT_VALUES);
     stopper(DestroyProcessStopper.INSTANCE);
-    redirectOutput(null);
-    redirectError(null);
+    redirectOutput(NullOutputStream.NULL_OUTPUT_STREAM);
+    redirectError(NullOutputStream.NULL_OUTPUT_STREAM);
     destroyer(null);
     redirectErrorStream(DEFAULT_REDIRECT_ERROR_STREAM);
   }
@@ -471,6 +471,19 @@ public class ProcessExecutor {
     return streams(new PumpStreamHandler(output, pumps == null ? null : pumps.getErr(), pumps == null ? null : pumps.getInput()));
   }
 
+  /**
+   * Redirects the process' output stream to given line consumer.
+   * If this method is invoked multiple times each call overwrites the previous.
+   * Use {@link #redirectOutputAlsoTo(OutputStream)} if you want to redirect the output to multiple streams.
+   *
+   * @param consumer consumer where the process output is redirected to.
+   * @return This process executor.
+   * @see #redirectOutput(OutputStream)
+   */
+  public ProcessExecutor redirectOutput(LineConsumer consumer) {
+    return redirectOutput(LogOutputStream.create(consumer));
+  }
+
   /**
    * Redirects the process' error stream to given output stream.
    * If this method is invoked multiple times each call overwrites the previous.
@@ -492,6 +505,19 @@ public class ProcessExecutor {
     return this;
   }
 
+  /**
+   * Redirects the process' error stream to given line consumer.
+   * If this method is invoked multiple times each call overwrites the previous.
+   * Use {@link #redirectErrorAlsoTo(OutputStream)} if you want to redirect the output to multiple streams.
+   *
+   * @param consumer consumer where the process error is redirected to.
+   * @return This process executor.
+   * @see #redirectError(OutputStream)
+   */
+  public ProcessExecutor redirectError(LineConsumer consumer) {
+    return redirectError(LogOutputStream.create(consumer));
+  }
+
   /**
    * Redirects the process' output stream also to a given output stream.
    * This method can be used to redirect output to multiple streams.


=====================================
src/main/java/org/zeroturnaround/exec/stream/LineConsumer.java
=====================================
@@ -0,0 +1,9 @@
+package org.zeroturnaround.exec.stream;
+
+/**
+ * This is equivalent to {@code java.util.function.Consumer} while staying compatible with
+ * Java versions earlier than 8.
+ */
+public interface LineConsumer {
+  void accept(String line);
+}


=====================================
src/main/java/org/zeroturnaround/exec/stream/LogOutputStream.java
=====================================
@@ -20,6 +20,7 @@ package org.zeroturnaround.exec.stream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
 
 /**
  * Base class to connect a logging system to the output and/or
@@ -30,7 +31,7 @@ import java.io.OutputStream;
 public abstract class LogOutputStream extends OutputStream {
 
   /** Initial buffer size. */
-  private static final int INTIAL_SIZE = 132;
+  private static final int INITIAL_SIZE = 132;
 
   /** Carriage return */
   private static final int CR = 0x0d;
@@ -40,10 +41,17 @@ public abstract class LogOutputStream extends OutputStream {
 
   /** the internal buffer */
   private final ByteArrayOutputStream buffer = new ByteArrayOutputStream(
-      INTIAL_SIZE);
+      INITIAL_SIZE);
 
   byte lastReceivedByte;
 
+  private String outputCharset;
+
+  public LogOutputStream setOutputCharset(final String outputCharset) {
+    this.outputCharset = outputCharset;
+    return this;
+  }
+
   /**
    * Write the data to the buffer and flush the buffer, if a line separator is
    * detected.
@@ -128,7 +136,17 @@ public abstract class LogOutputStream extends OutputStream {
    * Converts the buffer to a string and sends it to <code>processLine</code>.
    */
   protected void processBuffer() {
-    processLine(buffer.toString());
+    final String line;
+    if (outputCharset == null) {
+      line = buffer.toString();
+    } else {
+      try {
+        line = buffer.toString(outputCharset);
+      } catch (UnsupportedEncodingException e) {
+        throw new IllegalArgumentException(e);
+      }
+    }
+    processLine(line);
     buffer.reset();
   }
 
@@ -140,4 +158,22 @@ public abstract class LogOutputStream extends OutputStream {
    */
   protected abstract void processLine(String line);
 
+  /**
+   * Factory method to create a <code>LogOutputStream</code> that passes each line to the specified consumer.
+   * <p>Mostly useful with Java 8+, so the consumer can be passed as a lambda expression.</p>
+   *
+   * @param consumer the consumer to consume the log lines
+   * @return the created <code>LogOutputStream</code>, passing each line to the specified consumer.
+   */
+  public static LogOutputStream create(final LineConsumer consumer) {
+    if (consumer == null) {
+      throw new IllegalArgumentException("Line consumer must be provided.");
+    }
+    return new LogOutputStream() {
+      @Override
+      protected void processLine(String line) {
+        consumer.accept(line);
+      }
+    };
+  }
 }


=====================================
src/moduleInfo/java/module-info.java
=====================================
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2013 ZeroTurnaround <support at zeroturnaround.com>
+ * Copyright (C) 2026 Neeme Praks
+ * Contains fragments of code from Apache Commons Exec, rights owned
+ * by Apache Software Foundation (ASF).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// slf4j-api 1.7.x has no module descriptor, so org.slf4j is an automatic module.
+// `requires transitive` on it is intentional (see below) and the usual caveat — an
+// unstable derived module name — does not apply: slf4j-api pins
+// `Automatic-Module-Name: org.slf4j`, which is also slf4j 2.x's real module name.
+ at SuppressWarnings({"requires-transitive-automatic", "requires-automatic"})
+module org.zeroturnaround.exec {
+  // slf4j types appear in the public API (e.g. ProcessExecutor.info(org.slf4j.Logger)),
+  // so consumers reading this module also read org.slf4j.
+  requires transitive org.slf4j;
+
+  exports org.zeroturnaround.exec;
+  exports org.zeroturnaround.exec.close;
+  exports org.zeroturnaround.exec.listener;
+  exports org.zeroturnaround.exec.stop;
+  exports org.zeroturnaround.exec.stream;
+  exports org.zeroturnaround.exec.stream.slf4j;
+}


=====================================
src/test/java/org/zeroturnaround/exec/test/LogOutputStreamTest.java
=====================================
@@ -8,6 +8,7 @@ import java.util.List;
 
 import org.junit.Assert;
 import org.junit.Test;
+import org.zeroturnaround.exec.stream.LineConsumer;
 import org.zeroturnaround.exec.stream.LogOutputStream;
 
 public class LogOutputStreamTest {
@@ -74,4 +75,16 @@ public class LogOutputStreamTest {
 		testLogOutputStream("foo\n", "foo");
 	}
 
+	@Test
+	public void lambda() throws IOException {
+		final List<String> lines = new ArrayList<String>();
+		LogOutputStream out = LogOutputStream.create(new LineConsumer() {
+			@Override
+			public void accept(String line) {
+				lines.add(line);
+			}
+		});
+		out.write("foo\nbar\n".getBytes());
+		Assert.assertEquals(Arrays.asList("foo", "bar"), lines);
+	}
 }


=====================================
src/test/java/org/zeroturnaround/exec/test/ProcessListenerThrowTest.java
=====================================
@@ -26,10 +26,9 @@ public class ProcessListenerThrowTest {
     public void afterFinish(Process process, ProcessResult result) {
       super.afterFinish(process, result);
 
-      if (result.getOutput().getString().contains("java version")) {
+      if (result.getOutput().getString().contains("openjdk version") || result.getOutput().getString().contains("java version")) {
         throw new InvalidOutputException("Test", result);
       }
     }
   }
-
 }



View it on GitLab: https://salsa.debian.org/java-team/zt-exec/-/commit/b184943bd796ccfa4fd4e7b532cb740798efa4d3

-- 
View it on GitLab: https://salsa.debian.org/java-team/zt-exec/-/commit/b184943bd796ccfa4fd4e7b532cb740798efa4d3
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20261113/6547a6b9/attachment.htm>


More information about the pkg-java-commits mailing list