Skip to content
Merged
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
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand Down Expand Up @@ -130,7 +130,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand Down
32 changes: 19 additions & 13 deletions src/main/java/com/browserstack/local/Local.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@ public class Local {
private LocalProcess proc = null;

private final Map<String, String> parameters;
private final Map<String, String> avoidValueParameters;

public Local() {
avoidValueParameters = new HashMap<String, String>();
avoidValueParameters.put("v", "-vvv");
avoidValueParameters.put("force", "-force");
avoidValueParameters.put("forcelocal", "-forcelocal");
avoidValueParameters.put("onlyAutomate", "-onlyAutomate");
avoidValueParameters.put("forceproxy", "-forceproxy");

parameters = new HashMap<String, String>();
parameters.put("v", "-vvv");
parameters.put("f", "-f");
parameters.put("force", "-force");
parameters.put("only", "-only");
parameters.put("forcelocal", "-forcelocal");
parameters.put("localIdentifier", "-localIdentifier");
parameters.put("onlyAutomate", "-onlyAutomate");
parameters.put("proxyHost", "-proxyHost");
parameters.put("proxyPort", "-proxyPort");
parameters.put("proxyUser", "-proxyUser");
parameters.put("proxyPass", "-proxyPass");
parameters.put("forceproxy", "-forceproxy");
parameters.put("hosts", "-hosts");
}

/**
Expand Down Expand Up @@ -75,7 +77,7 @@ public void start(Map<String, String> options) throws Exception {

JSONObject obj = new JSONObject(!stdout.equals("") ? stdout : stderr);
if(!obj.getString("state").equals("connected")){
throw new LocalException(obj.getString("message"));
throw new LocalException(obj.getJSONObject("message").getString("message"));
}
else {
pid = obj.getInt("pid");
Expand Down Expand Up @@ -124,13 +126,17 @@ private void makeCommand(Map<String, String> options, String opCode) {
if (IGNORE_KEYS.contains(parameter)) {
continue;
}
if (parameters.get(parameter) != null) {
command.add(parameters.get(parameter));
if (avoidValueParameters.get(parameter) != null && opt.getValue().trim().toLowerCase() != "false") {
command.add(avoidValueParameters.get(parameter));
} else {
command.add("-" + parameter);
}
if (opt.getValue() != null) {
command.add(opt.getValue().trim());
if (parameters.get(parameter) != null) {
command.add(parameters.get(parameter));
} else {
command.add("-" + parameter);
}
if (opt.getValue() != null) {
command.add(opt.getValue().trim());
}
}
}
}
Expand Down