Skip to content

Commit ac4aa0b

Browse files
authored
Add a new parameter to shell function to allow redirect output in modal mode. (#533)
Issue: 94950
1 parent d5a9bc7 commit ac4aa0b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

java/src/main/java/com/genexus/GXutil.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,11 @@ public static byte openPrintDocument(String document)
10971097
}
10981098

10991099
public static byte shell(String cmd, int modal)
1100+
{
1101+
return GXutil.shell(cmd, modal, 0);
1102+
}
1103+
1104+
public static byte shell(String cmd, int modal, int redirectOutput)
11001105
{
11011106
try
11021107
{
@@ -1109,9 +1114,12 @@ public static byte shell(String cmd, int modal)
11091114
{
11101115
List<String> al = Arrays.asList(cmd.split(" "));
11111116
ProcessBuilder pb = new ProcessBuilder(al);
1112-
pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
1113-
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
1114-
pb.redirectInput(ProcessBuilder.Redirect.INHERIT);
1117+
if (redirectOutput == 1)
1118+
{
1119+
pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
1120+
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
1121+
pb.redirectInput(ProcessBuilder.Redirect.INHERIT);
1122+
}
11151123
Process p = pb.start();
11161124

11171125
byte exitCode = (byte) p.waitFor();

0 commit comments

Comments
 (0)