Skip to content

Commit d748f95

Browse files
committed
Use Protoc.runProtoc
Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
1 parent 1f072da commit d748f95

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

impl/grpc/src/main/java/io/serverlessworkflow/impl/executors/grpc/FileDescriptorReader.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package io.serverlessworkflow.impl.executors.grpc;
1717

18+
import com.github.os72.protocjar.Protoc;
1819
import com.google.protobuf.DescriptorProtos;
1920
import io.serverlessworkflow.impl.resources.ExternalResourceHandler;
2021
import io.serverlessworkflow.impl.scripts.ScriptUtils;
@@ -89,15 +90,21 @@ private static void generateFileDescriptor(Path grpcDir, Path protoFile, Path de
8990

9091
try {
9192

92-
ProcessBuilder processBuilder = new ProcessBuilder(protocArgs);
93-
int status = ScriptUtils.uncheckedStart(processBuilder).waitFor();
93+
int status = Protoc.runProtoc(protocArgs);
94+
95+
// TODO: I need to resolve the protoc file from PATH or from JARs, supporting all OS systems.
96+
// ProcessBuilder processBuilder = new ProcessBuilder(protocArgs);
97+
// int status = ScriptUtils.uncheckedStart(processBuilder).waitFor();
98+
9499
if (status != 0) {
95100
throw new RuntimeException(
96101
"Unable to generate file descriptor, 'protoc' execution failed with status " + status);
97102
}
98103
} catch (InterruptedException e) {
99104
Thread.currentThread().interrupt();
100105
throw new RuntimeException("Unable to generate file descriptor", e);
106+
} catch (IOException e) {
107+
throw new UncheckedIOException("Unable to generate file descriptor", e);
101108
}
102109
}
103110
}

0 commit comments

Comments
 (0)