Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ ssh_server.jar
cache/working/*
cache/dep/*
jre/*
job_work/*
job_work*/*
.metadata/*
pftt_release.zip
8 changes: 8 additions & 0 deletions src/com/mostc/pftt/host/LocalHost.java
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,14 @@ protected void run(StringBuilder output_sb, int max_chars, Charset charset, int
}
}*/
//

// try to set exit code after execution
try {
exit_code = p.exitValue();
} catch (IllegalThreadStateException ex )
{
ConsoleManagerUtil.printStackTrace(LocalHost.class, ex);
}

active_proc_counter.decrementAndGet();

Expand Down
5 changes: 2 additions & 3 deletions src/com/mostc/pftt/util/HostEnvUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -669,11 +669,10 @@ private static void downloadFile(FileSystemScenario fs, LocalConsoleManager cm,
private static void addRuleToFirewall(ConsoleManager cm, AHost host, String name, String installerFile) throws IOException, Exception {
String rule = name.replace(' ', '_');

ExecOutput op = host.execOut("cmd /c powershell -Command \"if ($(Get-NetFirewallRule -DisplayName '"+ rule + "')) {echo 'found'} else { echo 'not found' }\" 2>nul", AHost.TEN_MINUTES);
ExecOutput op = host.execOut("netsh advfirewall firewall show rule name=" + rule, AHost.ONE_MINUTE);

// Check if rule exists for file, if not add it
// TODO: Adjust to use exit status, but have to figure out why java overwrites status code.
if(op.output.contains("not found")) {
if(op.exit_code != 0) {
cm.println(EPrintType.IN_PROGRESS, HostEnvUtil.class, "Adding " + name + " as rule for the firewall...");
host.execElevated(cm, HostEnvUtil.class, "netsh advfirewall firewall add rule name=" + rule + " dir=in action=allow "
+ "program=\""+ installerFile +"\" enable=yes remoteip=127.0.0.1", AHost.ONE_MINUTE);
Expand Down