Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Code modified to work on windows platform #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,31 @@ public void startInstance() throws Exception
}

File binDirectory = new File(details.zooKeeperDirectory, "bin");
File startScript = new File(binDirectory, "zkServer.sh");
File startScript = null;
if (isWindows())
{
startScript = new File(binDirectory, "zkServer.cmd");
}
else
{
startScript = new File(binDirectory, "zkServer.sh");
}
ProcessBuilder builder = new ProcessBuilder(startScript.getPath(), "start").directory(binDirectory.getParentFile());

exhibitor.getProcessMonitor().monitor(ProcessTypes.ZOOKEEPER, builder.start(), null, ProcessMonitor.Mode.LEAVE_RUNNING_ON_INTERRUPT, ProcessMonitor.Streams.BOTH);

exhibitor.getLog().add(ActivityLog.Type.INFO, "Process started via: " + startScript.getPath());
}


private static String getOsName()
{
if(OS == null) { OS = System.getProperty("os.name"); }
return OS;
}
private static boolean isWindows()
{
return getOsName().startsWith("Windows");
}
private void prepConfigFile(Details details) throws IOException
{
UsState usState = new UsState(exhibitor);
Expand Down