Skip to content

Add tooling pattern: Runtime.exec(String) to ProcessBuilder arguments - #215

Merged
brunoborges merged 2 commits into
mainfrom
copilot/runtime-exec-to-process-builder
Aug 27, 2026
Merged

Add tooling pattern: Runtime.exec(String) to ProcessBuilder arguments#215
brunoborges merged 2 commits into
mainfrom
copilot/runtime-exec-to-process-builder

Conversation

Copilot AI commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Adds the requested tooling/runtime-exec-to-process-builder pattern contrasting Runtime.exec(String) command-string tokenization with an explicit ProcessBuilder argument list.

// Command string
Process process = Runtime.getRuntime()
        .exec("git show " + revision);

// ProcessBuilder
Process process = new ProcessBuilder(
        "git", "show", revision)
        .redirectErrorStream(true)
        .start();

Content

  • content/tooling/runtime-exec-to-process-builder.yamljdkVersion: 5, difficulty: intermediate, support.state: available. Both approaches predate/ship in JDK 5, so labels are descriptive (Command string / ProcessBuilder) rather than version-based.
  • Tags tooling + security (both already in tags.properties); docs link to ProcessBuilder and Runtime.exec(String).
  • related: concurrency/process-api, io/inputstream-transferto, security/security-manager-migration.

Navigation

  • Inserted between tooling/junit6-with-jspecify and language/anonymous-classes-to-lambdas; both neighbours' next/prev updated to keep the global chain reciprocal.

Proof

  • proof/tooling/RuntimeExecToProcessBuilder.java runs the modern snippet, drains stdout and waits for exit — CI executes proofs rather than only compiling them.

Translations

  • Partial translations for all 13 non-English locales, limited to the translatable fields (title, oldApproach, modernApproach, summary, explanation, whyModernWins, support.description).

Social

  • social/queue.txt and social/tweets.yaml regenerated without --reshuffle, so only the new entry is appended; social/state.yaml untouched.

Co-authored-by: brunoborges <129743+brunoborges@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor Runtime.exec(String) usage to ProcessBuilder Add tooling pattern: Runtime.exec(String) to ProcessBuilder arguments Aug 27, 2026
Copilot AI requested a review from brunoborges August 27, 2026 16:02
@brunoborges
brunoborges marked this pull request as ready for review August 27, 2026 16:04
@brunoborges
brunoborges requested a balanced review from Copilot August 27, 2026 16:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a tooling pattern recommending explicit ProcessBuilder arguments over Runtime.exec(String) tokenization.

Changes:

  • Adds pattern content, reciprocal navigation, and executable proof.
  • Adds translations for all 13 non-English locales.
  • Appends generated social queue and tweet entries.
Show a summary per file
File Description
content/tooling/runtime-exec-to-process-builder.yaml Defines the new pattern.
content/tooling/junit6-with-jspecify.yaml Links forward to the pattern.
content/language/anonymous-classes-to-lambdas.yaml Links back to the pattern.
proof/tooling/RuntimeExecToProcessBuilder.java Executes and drains the modern example.
social/queue.txt Queues the pattern.
social/tweets.yaml Adds its social post.
translations/content/ar/tooling/runtime-exec-to-process-builder.yaml Adds Arabic content.
translations/content/bn/tooling/runtime-exec-to-process-builder.yaml Adds Bengali content.
translations/content/de/tooling/runtime-exec-to-process-builder.yaml Adds German content.
translations/content/es/tooling/runtime-exec-to-process-builder.yaml Adds Spanish content.
translations/content/fr/tooling/runtime-exec-to-process-builder.yaml Adds French content.
translations/content/it/tooling/runtime-exec-to-process-builder.yaml Adds Italian content.
translations/content/ja/tooling/runtime-exec-to-process-builder.yaml Adds Japanese content.
translations/content/ko/tooling/runtime-exec-to-process-builder.yaml Adds Korean content.
translations/content/pl/tooling/runtime-exec-to-process-builder.yaml Adds Polish content.
translations/content/pt-BR/tooling/runtime-exec-to-process-builder.yaml Adds Brazilian Portuguese content.
translations/content/ru/tooling/runtime-exec-to-process-builder.yaml Adds Russian content.
translations/content/tr/tooling/runtime-exec-to-process-builder.yaml Adds Turkish content.
translations/content/zh-CN/tooling/runtime-exec-to-process-builder.yaml Adds Simplified Chinese content.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 19/19 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@brunoborges
brunoborges merged commit 9640aaa into main Aug 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Pattern] Runtime.exec(String) to ProcessBuilder arguments

3 participants