Project

General

Profile

Actions

Task #1767

closed

Run on Windows

Added by Roman Kučera almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Tomáš Doischer
Target version:
Start date:
07/30/2019
Due date:
% Done:

100%

Estimated time:
Owner:

Description

Now when you want to execute caw on Windows in git-bash you are not able to get the response nor response code from the bash script.

So the issue is we are not able to run bash script on windows and get the output from it.

In module we are creating new process via ProcessBuilder.

Tried solutions in crt module in win driver:
command is just path to bash script

Runtime run = Runtime.getRuntime();
return run.exec(new String[]{"\"C:\\Program Files\\Git\\git-bash.exe\"", "-c", command});


ProcessBuilder pb = new ProcessBuilder();
pb.command("\"C:\\Program Files\\Git\\git-bash.exe\"", "-c", command);
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
pb.redirectInput(ProcessBuilder.Redirect.INHERIT);
pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
return pb.start();


ProcessBuilder pb = new ProcessBuilder("cmd.exe");
pb.inheritIO().command("\"C:\\Program Files\\Git\\git-bash.exe\"", "-c", command);

Some links with examples to ProcessBuilder
https://www.mkyong.com/java/java-processbuilder-examples/
https://stackoverflow.com/questions/14165517/processbuilder-forwarding-stdout-and-stderr-of-started-processes-without-blocki
http://www.javasavvy.com/execute-shell-script-java-using-process-builder/

Actions

Also available in: Atom PDF