This document describes the gRPC API for the Makefile Command Runner service.
The service is defined in service.proto
and provides the following RPC methods:
Executes a Makefile command and returns the output.
message CommandRequest {
string command = 1; // The make command to run (e.g., "test", "clean")
repeated string args = 2; // Optional arguments for the command
}
message CommandResponse {
string output = 1; // Standard output from the command
string error = 2; // Standard error from the command
int32 return_code = 3; // Return code from the command
}
The service may return the following gRPC status codes:
OK
(0): The command was executed successfullyINVALID_ARGUMENT
(3): Invalid command or argumentsINTERNAL
(13): An internal error occurred while executing the commandimport grpc
import service_pb2
import service_pb2_grpc
def run_command(command, args=None):
with grpc.insecure_channel('localhost:50051') as channel:
stub = service_pb2_grpc.MakefileServiceStub(channel)
response = stub.RunCommand(
service_pb2.CommandRequest(command=command, args=args or [])
)
return response
# Example usage
response = run_command("test")
print(f"Output: {response.output}")
if response.return_code != 0:
print(f"Error: {response.error}")
Currently, the service does not implement authentication. It is recommended to: