Fix .exe file extensions (#9197)

Co-authored-by: Mehrdad <noreply@github.com>
This commit is contained in:
mehrdadn
2020-07-02 13:29:34 -07:00
committed by GitHub
parent a25472c657
commit 7135cb2aec
9 changed files with 67 additions and 59 deletions
@@ -253,7 +253,7 @@ public class RunManager {
private String startRedisInstance(String ip, int port, String password, Integer shard) {
final File redisServerFile = BinaryFileUtil.getFile(
rayConfig.sessionDir, BinaryFileUtil.REDIS_SERVER_BINARY_NAME);
rayConfig.sessionDir, BinaryFileUtil.REDIS_SERVER_BINARY_PATH);
Preconditions.checkState(redisServerFile.setExecutable(true));
List<String> command = Lists.newArrayList(
// The redis-server executable file.
@@ -11,7 +11,9 @@ import java.nio.file.Paths;
import org.apache.commons.io.FileUtils;
public class BinaryFileUtil {
public static final String REDIS_SERVER_BINARY_NAME = "redis-server";
// We use a path here because the top-level Bazel target is an alias
public static final String REDIS_SERVER_BINARY_PATH =
"external/com_github_antirez_redis/redis-server";
public static final String GCS_SERVER_BINARY_NAME = "gcs_server";
@@ -30,10 +32,11 @@ public class BinaryFileUtil {
* directory concurrently, this operation will be protected by a file lock.
*
* @param destDir a directory to extract resource file to
* @param fileName resource file name
* @param filePath resource file path
* @return extracted resource file
*/
public static File getFile(String destDir, String fileName) {
public static File getFile(String destDir, String filePath) {
String fileName = new File(filePath).getName();
final File dir = new File(destDir);
if (!dir.exists()) {
try {
@@ -51,11 +54,11 @@ public class BinaryFileUtil {
}
// File does not exist.
try (InputStream is = BinaryFileUtil.class.getResourceAsStream("/" + fileName)) {
Preconditions.checkNotNull(is, "{} doesn't exist.", fileName);
try (InputStream is = BinaryFileUtil.class.getResourceAsStream("/" + filePath)) {
Preconditions.checkNotNull(is, "{} doesn't exist.", filePath);
Files.copy(is, Paths.get(file.getCanonicalPath()));
} catch (IOException e) {
throw new RuntimeException("Couldn't get temp file from resource " + fileName, e);
throw new RuntimeException("Couldn't get temp file from resource " + filePath, e);
}
return file;
} catch (IOException e) {