This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch jline3
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/jline3 by this push:
     new 4818477064 better handling for invoking shell commands
4818477064 is described below

commit 4818477064d1c74e84f758f908bfd947d4b6a578
Author: Paul King <pa...@asert.com.au>
AuthorDate: Mon Jun 23 18:25:34 2025 +1000

    better handling for invoking shell commands
---
 .../src/main/groovy/org/apache/groovy/groovysh/Main2.groovy            | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main2.groovy
 
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main2.groovy
index 7eea690f40..9ab7126c92 100644
--- 
a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main2.groovy
+++ 
b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main2.groovy
@@ -181,7 +181,8 @@ class Main2 {
 
         private static void executeCommand(List<String> args) throws Exception 
{
             def sout = new StringBuilder(), serr = new StringBuilder()
-            def proc = args.join(' ').execute()
+            def command = OSUtils.IS_WINDOWS ? ['cmd.exe', '/c'] : ['sh', '-c']
+            def proc = new ProcessBuilder().command(command + args.join(' 
')).start()
             proc.consumeProcessOutput(sout, serr)
             int exitCode = proc.waitFor()
             if (sout.size()) print sout

Reply via email to