Skip to content

Commit

Permalink
fix: Fix Sonomano execution error
Browse files Browse the repository at this point in the history
  • Loading branch information
devleejb committed Oct 31, 2023
1 parent b855803 commit 8ef90e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/main/java/redis/embedded/RedisExecProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
import java.util.Map;

public class RedisExecProvider {

private final Map<OsArchitecture, String> executables = Maps.newHashMap();

public static RedisExecProvider defaultProvider() {
return new RedisExecProvider();
}

private RedisExecProvider() {
initExecutables();
}
Expand All @@ -30,8 +30,8 @@ private void initExecutables() {
executables.put(OsArchitecture.UNIX_x86, "redis-server-2.8.19-32");
executables.put(OsArchitecture.UNIX_x86_64, "redis-server-2.8.19");

executables.put(OsArchitecture.MAC_OS_X_x86, "redis-server-2.8.19.app");
executables.put(OsArchitecture.MAC_OS_X_x86_64, "redis-server-2.8.19.app");
executables.put(OsArchitecture.MAC_OS_X_x86, "redis-server-mac-7.2.2");
executables.put(OsArchitecture.MAC_OS_X_x86_64, "redis-server-mac-7.2.2");
}

public RedisExecProvider override(OS os, String executable) {
Expand All @@ -47,14 +47,12 @@ public RedisExecProvider override(OS os, Architecture arch, String executable) {
executables.put(new OsArchitecture(os, arch), executable);
return this;
}

public File get() throws IOException {
OsArchitecture osArch = OsArchitecture.detect();
String executablePath = executables.get(osArch);
return fileExists(executablePath) ?
new File(executablePath) :
JarUtil.extractExecutableFromJar(executablePath);

return fileExists(executablePath) ? new File(executablePath) : JarUtil.extractExecutableFromJar(executablePath);

}

private boolean fileExists(String executablePath) {
Expand Down
Binary file removed src/main/resources/redis-server-2.8.19.app
Binary file not shown.
Binary file added src/main/resources/redis-server-mac-7.2.2
Binary file not shown.

0 comments on commit 8ef90e9

Please sign in to comment.