Wrap exec signals in a message
This commit is contained in:
parent
00c2957a1c
commit
b74b1c3a4c
|
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// protoc v7.35.1
|
||||
// source: rpc/agent.proto
|
||||
|
||||
package rpc
|
||||
|
|
@ -22,53 +22,53 @@ const (
|
|||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type ExecRequest_Signal int32
|
||||
type ExecRequest_SendSignal_Signal int32
|
||||
|
||||
const (
|
||||
ExecRequest_SIGNAL_UNSPECIFIED ExecRequest_Signal = 0
|
||||
ExecRequest_SIGNAL_SIGTERM ExecRequest_Signal = 1
|
||||
ExecRequest_SIGNAL_SIGKILL ExecRequest_Signal = 2
|
||||
ExecRequest_SendSignal_SIGNAL_UNSPECIFIED ExecRequest_SendSignal_Signal = 0
|
||||
ExecRequest_SendSignal_SIGNAL_SIGTERM ExecRequest_SendSignal_Signal = 1
|
||||
ExecRequest_SendSignal_SIGNAL_SIGKILL ExecRequest_SendSignal_Signal = 2
|
||||
)
|
||||
|
||||
// Enum value maps for ExecRequest_Signal.
|
||||
// Enum value maps for ExecRequest_SendSignal_Signal.
|
||||
var (
|
||||
ExecRequest_Signal_name = map[int32]string{
|
||||
ExecRequest_SendSignal_Signal_name = map[int32]string{
|
||||
0: "SIGNAL_UNSPECIFIED",
|
||||
1: "SIGNAL_SIGTERM",
|
||||
2: "SIGNAL_SIGKILL",
|
||||
}
|
||||
ExecRequest_Signal_value = map[string]int32{
|
||||
ExecRequest_SendSignal_Signal_value = map[string]int32{
|
||||
"SIGNAL_UNSPECIFIED": 0,
|
||||
"SIGNAL_SIGTERM": 1,
|
||||
"SIGNAL_SIGKILL": 2,
|
||||
}
|
||||
)
|
||||
|
||||
func (x ExecRequest_Signal) Enum() *ExecRequest_Signal {
|
||||
p := new(ExecRequest_Signal)
|
||||
func (x ExecRequest_SendSignal_Signal) Enum() *ExecRequest_SendSignal_Signal {
|
||||
p := new(ExecRequest_SendSignal_Signal)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x ExecRequest_Signal) String() string {
|
||||
func (x ExecRequest_SendSignal_Signal) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (ExecRequest_Signal) Descriptor() protoreflect.EnumDescriptor {
|
||||
func (ExecRequest_SendSignal_Signal) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_rpc_agent_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (ExecRequest_Signal) Type() protoreflect.EnumType {
|
||||
func (ExecRequest_SendSignal_Signal) Type() protoreflect.EnumType {
|
||||
return &file_rpc_agent_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x ExecRequest_Signal) Number() protoreflect.EnumNumber {
|
||||
func (x ExecRequest_SendSignal_Signal) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ExecRequest_Signal.Descriptor instead.
|
||||
func (ExecRequest_Signal) EnumDescriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{0, 0}
|
||||
// Deprecated: Use ExecRequest_SendSignal_Signal.Descriptor instead.
|
||||
func (ExecRequest_SendSignal_Signal) EnumDescriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{0, 0, 0}
|
||||
}
|
||||
|
||||
type ExecRequest struct {
|
||||
|
|
@ -78,7 +78,7 @@ type ExecRequest struct {
|
|||
// *ExecRequest_Command_
|
||||
// *ExecRequest_StandardInput
|
||||
// *ExecRequest_TerminalResize
|
||||
// *ExecRequest_Signal_
|
||||
// *ExecRequest_SendSignal_
|
||||
Type isExecRequest_Type `protobuf_oneof:"type"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
|
@ -148,13 +148,13 @@ func (x *ExecRequest) GetTerminalResize() *TerminalSize {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *ExecRequest) GetSignal() ExecRequest_Signal {
|
||||
func (x *ExecRequest) GetSendSignal() *ExecRequest_SendSignal {
|
||||
if x != nil {
|
||||
if x, ok := x.Type.(*ExecRequest_Signal_); ok {
|
||||
return x.Signal
|
||||
if x, ok := x.Type.(*ExecRequest_SendSignal_); ok {
|
||||
return x.SendSignal
|
||||
}
|
||||
}
|
||||
return ExecRequest_SIGNAL_UNSPECIFIED
|
||||
return nil
|
||||
}
|
||||
|
||||
type isExecRequest_Type interface {
|
||||
|
|
@ -173,8 +173,8 @@ type ExecRequest_TerminalResize struct {
|
|||
TerminalResize *TerminalSize `protobuf:"bytes,3,opt,name=terminal_resize,json=terminalResize,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ExecRequest_Signal_ struct {
|
||||
Signal ExecRequest_Signal `protobuf:"varint,4,opt,name=signal,proto3,enum=ExecRequest_Signal,oneof"`
|
||||
type ExecRequest_SendSignal_ struct {
|
||||
SendSignal *ExecRequest_SendSignal `protobuf:"bytes,4,opt,name=send_signal,json=sendSignal,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*ExecRequest_Command_) isExecRequest_Type() {}
|
||||
|
|
@ -183,7 +183,7 @@ func (*ExecRequest_StandardInput) isExecRequest_Type() {}
|
|||
|
||||
func (*ExecRequest_TerminalResize) isExecRequest_Type() {}
|
||||
|
||||
func (*ExecRequest_Signal_) isExecRequest_Type() {}
|
||||
func (*ExecRequest_SendSignal_) isExecRequest_Type() {}
|
||||
|
||||
type ExecResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
|
|
@ -475,6 +475,50 @@ func (x *ResolveIPResponse) GetIp() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
type ExecRequest_SendSignal struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Signal ExecRequest_SendSignal_Signal `protobuf:"varint,1,opt,name=signal,proto3,enum=ExecRequest_SendSignal_Signal" json:"signal,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ExecRequest_SendSignal) Reset() {
|
||||
*x = ExecRequest_SendSignal{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ExecRequest_SendSignal) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ExecRequest_SendSignal) ProtoMessage() {}
|
||||
|
||||
func (x *ExecRequest_SendSignal) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ExecRequest_SendSignal.ProtoReflect.Descriptor instead.
|
||||
func (*ExecRequest_SendSignal) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
func (x *ExecRequest_SendSignal) GetSignal() ExecRequest_SendSignal_Signal {
|
||||
if x != nil {
|
||||
return x.Signal
|
||||
}
|
||||
return ExecRequest_SendSignal_SIGNAL_UNSPECIFIED
|
||||
}
|
||||
|
||||
type ExecRequest_Command struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
|
|
@ -491,7 +535,7 @@ type ExecRequest_Command struct {
|
|||
|
||||
func (x *ExecRequest_Command) Reset() {
|
||||
*x = ExecRequest_Command{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[6]
|
||||
mi := &file_rpc_agent_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -503,7 +547,7 @@ func (x *ExecRequest_Command) String() string {
|
|||
func (*ExecRequest_Command) ProtoMessage() {}
|
||||
|
||||
func (x *ExecRequest_Command) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[6]
|
||||
mi := &file_rpc_agent_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -516,7 +560,7 @@ func (x *ExecRequest_Command) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use ExecRequest_Command.ProtoReflect.Descriptor instead.
|
||||
func (*ExecRequest_Command) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{0, 0}
|
||||
return file_rpc_agent_proto_rawDescGZIP(), []int{0, 1}
|
||||
}
|
||||
|
||||
func (x *ExecRequest_Command) GetName() string {
|
||||
|
|
@ -584,7 +628,7 @@ type ExecResponse_Exit struct {
|
|||
|
||||
func (x *ExecResponse_Exit) Reset() {
|
||||
*x = ExecResponse_Exit{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[8]
|
||||
mi := &file_rpc_agent_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -596,7 +640,7 @@ func (x *ExecResponse_Exit) String() string {
|
|||
func (*ExecResponse_Exit) ProtoMessage() {}
|
||||
|
||||
func (x *ExecResponse_Exit) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[8]
|
||||
mi := &file_rpc_agent_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -627,7 +671,7 @@ type ExecResponse_Started struct {
|
|||
|
||||
func (x *ExecResponse_Started) Reset() {
|
||||
*x = ExecResponse_Started{}
|
||||
mi := &file_rpc_agent_proto_msgTypes[9]
|
||||
mi := &file_rpc_agent_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -639,7 +683,7 @@ func (x *ExecResponse_Started) String() string {
|
|||
func (*ExecResponse_Started) ProtoMessage() {}
|
||||
|
||||
func (x *ExecResponse_Started) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_agent_proto_msgTypes[9]
|
||||
mi := &file_rpc_agent_proto_msgTypes[10]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -659,12 +703,20 @@ var File_rpc_agent_proto protoreflect.FileDescriptor
|
|||
|
||||
const file_rpc_agent_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x0frpc/agent.proto\x1a\x1bgoogle/protobuf/empty.proto\"\xe4\x04\n" +
|
||||
"\x0frpc/agent.proto\x1a\x1bgoogle/protobuf/empty.proto\"\xb8\x05\n" +
|
||||
"\vExecRequest\x120\n" +
|
||||
"\acommand\x18\x01 \x01(\v2\x14.ExecRequest.CommandH\x00R\acommand\x121\n" +
|
||||
"\x0estandard_input\x18\x02 \x01(\v2\b.IOChunkH\x00R\rstandardInput\x128\n" +
|
||||
"\x0fterminal_resize\x18\x03 \x01(\v2\r.TerminalSizeH\x00R\x0eterminalResize\x12-\n" +
|
||||
"\x06signal\x18\x04 \x01(\x0e2\x13.ExecRequest.SignalH\x00R\x06signal\x1a\xb4\x02\n" +
|
||||
"\x0fterminal_resize\x18\x03 \x01(\v2\r.TerminalSizeH\x00R\x0eterminalResize\x12:\n" +
|
||||
"\vsend_signal\x18\x04 \x01(\v2\x17.ExecRequest.SendSignalH\x00R\n" +
|
||||
"sendSignal\x1a\x8e\x01\n" +
|
||||
"\n" +
|
||||
"SendSignal\x126\n" +
|
||||
"\x06signal\x18\x01 \x01(\x0e2\x1e.ExecRequest.SendSignal.SignalR\x06signal\"H\n" +
|
||||
"\x06Signal\x12\x16\n" +
|
||||
"\x12SIGNAL_UNSPECIFIED\x10\x00\x12\x12\n" +
|
||||
"\x0eSIGNAL_SIGTERM\x10\x01\x12\x12\n" +
|
||||
"\x0eSIGNAL_SIGKILL\x10\x02\x1a\xb4\x02\n" +
|
||||
"\aCommand\x12\x12\n" +
|
||||
"\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" +
|
||||
"\x04args\x18\x02 \x03(\tR\x04args\x12 \n" +
|
||||
|
|
@ -676,11 +728,7 @@ const file_rpc_agent_proto_rawDesc = "" +
|
|||
"\aworkdir\x18\b \x01(\tR\aworkdir\x1a6\n" +
|
||||
"\bEnvEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"H\n" +
|
||||
"\x06Signal\x12\x16\n" +
|
||||
"\x12SIGNAL_UNSPECIFIED\x10\x00\x12\x12\n" +
|
||||
"\x0eSIGNAL_SIGTERM\x10\x01\x12\x12\n" +
|
||||
"\x0eSIGNAL_SIGKILL\x10\x02B\x06\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x06\n" +
|
||||
"\x04type\"\x82\x02\n" +
|
||||
"\fExecResponse\x12(\n" +
|
||||
"\x04exit\x18\x01 \x01(\v2\x12.ExecResponse.ExitH\x00R\x04exit\x123\n" +
|
||||
|
|
@ -716,40 +764,42 @@ func file_rpc_agent_proto_rawDescGZIP() []byte {
|
|||
}
|
||||
|
||||
var file_rpc_agent_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_rpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_rpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_rpc_agent_proto_goTypes = []any{
|
||||
(ExecRequest_Signal)(0), // 0: ExecRequest.Signal
|
||||
(*ExecRequest)(nil), // 1: ExecRequest
|
||||
(*ExecResponse)(nil), // 2: ExecResponse
|
||||
(*TerminalSize)(nil), // 3: TerminalSize
|
||||
(*IOChunk)(nil), // 4: IOChunk
|
||||
(*ResolveIPRequest)(nil), // 5: ResolveIPRequest
|
||||
(*ResolveIPResponse)(nil), // 6: ResolveIPResponse
|
||||
(*ExecRequest_Command)(nil), // 7: ExecRequest.Command
|
||||
nil, // 8: ExecRequest.Command.EnvEntry
|
||||
(*ExecResponse_Exit)(nil), // 9: ExecResponse.Exit
|
||||
(*ExecResponse_Started)(nil), // 10: ExecResponse.Started
|
||||
(ExecRequest_SendSignal_Signal)(0), // 0: ExecRequest.SendSignal.Signal
|
||||
(*ExecRequest)(nil), // 1: ExecRequest
|
||||
(*ExecResponse)(nil), // 2: ExecResponse
|
||||
(*TerminalSize)(nil), // 3: TerminalSize
|
||||
(*IOChunk)(nil), // 4: IOChunk
|
||||
(*ResolveIPRequest)(nil), // 5: ResolveIPRequest
|
||||
(*ResolveIPResponse)(nil), // 6: ResolveIPResponse
|
||||
(*ExecRequest_SendSignal)(nil), // 7: ExecRequest.SendSignal
|
||||
(*ExecRequest_Command)(nil), // 8: ExecRequest.Command
|
||||
nil, // 9: ExecRequest.Command.EnvEntry
|
||||
(*ExecResponse_Exit)(nil), // 10: ExecResponse.Exit
|
||||
(*ExecResponse_Started)(nil), // 11: ExecResponse.Started
|
||||
}
|
||||
var file_rpc_agent_proto_depIdxs = []int32{
|
||||
7, // 0: ExecRequest.command:type_name -> ExecRequest.Command
|
||||
8, // 0: ExecRequest.command:type_name -> ExecRequest.Command
|
||||
4, // 1: ExecRequest.standard_input:type_name -> IOChunk
|
||||
3, // 2: ExecRequest.terminal_resize:type_name -> TerminalSize
|
||||
0, // 3: ExecRequest.signal:type_name -> ExecRequest.Signal
|
||||
9, // 4: ExecResponse.exit:type_name -> ExecResponse.Exit
|
||||
7, // 3: ExecRequest.send_signal:type_name -> ExecRequest.SendSignal
|
||||
10, // 4: ExecResponse.exit:type_name -> ExecResponse.Exit
|
||||
4, // 5: ExecResponse.standard_output:type_name -> IOChunk
|
||||
4, // 6: ExecResponse.standard_error:type_name -> IOChunk
|
||||
10, // 7: ExecResponse.started:type_name -> ExecResponse.Started
|
||||
3, // 8: ExecRequest.Command.terminal_size:type_name -> TerminalSize
|
||||
8, // 9: ExecRequest.Command.env:type_name -> ExecRequest.Command.EnvEntry
|
||||
1, // 10: Agent.Exec:input_type -> ExecRequest
|
||||
5, // 11: Agent.ResolveIP:input_type -> ResolveIPRequest
|
||||
2, // 12: Agent.Exec:output_type -> ExecResponse
|
||||
6, // 13: Agent.ResolveIP:output_type -> ResolveIPResponse
|
||||
12, // [12:14] is the sub-list for method output_type
|
||||
10, // [10:12] is the sub-list for method input_type
|
||||
10, // [10:10] is the sub-list for extension type_name
|
||||
10, // [10:10] is the sub-list for extension extendee
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
11, // 7: ExecResponse.started:type_name -> ExecResponse.Started
|
||||
0, // 8: ExecRequest.SendSignal.signal:type_name -> ExecRequest.SendSignal.Signal
|
||||
3, // 9: ExecRequest.Command.terminal_size:type_name -> TerminalSize
|
||||
9, // 10: ExecRequest.Command.env:type_name -> ExecRequest.Command.EnvEntry
|
||||
1, // 11: Agent.Exec:input_type -> ExecRequest
|
||||
5, // 12: Agent.ResolveIP:input_type -> ResolveIPRequest
|
||||
2, // 13: Agent.Exec:output_type -> ExecResponse
|
||||
6, // 14: Agent.ResolveIP:output_type -> ResolveIPResponse
|
||||
13, // [13:15] is the sub-list for method output_type
|
||||
11, // [11:13] is the sub-list for method input_type
|
||||
11, // [11:11] is the sub-list for extension type_name
|
||||
11, // [11:11] is the sub-list for extension extendee
|
||||
0, // [0:11] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_rpc_agent_proto_init() }
|
||||
|
|
@ -761,7 +811,7 @@ func file_rpc_agent_proto_init() {
|
|||
(*ExecRequest_Command_)(nil),
|
||||
(*ExecRequest_StandardInput)(nil),
|
||||
(*ExecRequest_TerminalResize)(nil),
|
||||
(*ExecRequest_Signal_)(nil),
|
||||
(*ExecRequest_SendSignal_)(nil),
|
||||
}
|
||||
file_rpc_agent_proto_msgTypes[1].OneofWrappers = []any{
|
||||
(*ExecResponse_Exit_)(nil),
|
||||
|
|
@ -775,7 +825,7 @@ func file_rpc_agent_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_rpc_agent_proto_rawDesc), len(file_rpc_agent_proto_rawDesc)),
|
||||
NumEnums: 1,
|
||||
NumMessages: 10,
|
||||
NumMessages: 11,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -234,16 +234,16 @@ func (rpc *RPC) Exec(stream grpc.BidiStreamingServer[ExecRequest, ExecResponse])
|
|||
|
||||
return
|
||||
}
|
||||
case *ExecRequest_Signal_:
|
||||
case *ExecRequest_SendSignal_:
|
||||
var signal syscall.Signal
|
||||
|
||||
switch typedAction.Signal {
|
||||
case ExecRequest_SIGNAL_SIGTERM:
|
||||
switch typedAction.SendSignal.GetSignal() {
|
||||
case ExecRequest_SendSignal_SIGNAL_SIGTERM:
|
||||
signal = syscall.SIGTERM
|
||||
case ExecRequest_SIGNAL_SIGKILL:
|
||||
case ExecRequest_SendSignal_SIGNAL_SIGKILL:
|
||||
signal = syscall.SIGKILL
|
||||
default:
|
||||
reportClientError(fmt.Errorf("unsupported exec signal %q", typedAction.Signal.String()))
|
||||
reportClientError(fmt.Errorf("unsupported exec signal %q", typedAction.SendSignal.GetSignal().String()))
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,23 +131,23 @@ func TestExecReportsStartFailureBeforeStarted(t *testing.T) {
|
|||
func TestExecSignalsProcess(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
signal ExecRequest_Signal
|
||||
signal ExecRequest_SendSignal_Signal
|
||||
code int32
|
||||
err string
|
||||
}{
|
||||
{
|
||||
name: "SIGTERM",
|
||||
signal: ExecRequest_SIGNAL_SIGTERM,
|
||||
signal: ExecRequest_SendSignal_SIGNAL_SIGTERM,
|
||||
code: int32(signalExitCodeOffset + syscall.SIGTERM),
|
||||
},
|
||||
{
|
||||
name: "SIGKILL",
|
||||
signal: ExecRequest_SIGNAL_SIGKILL,
|
||||
signal: ExecRequest_SendSignal_SIGNAL_SIGKILL,
|
||||
code: int32(signalExitCodeOffset + syscall.SIGKILL),
|
||||
},
|
||||
{
|
||||
name: "unsupported",
|
||||
signal: ExecRequest_SIGNAL_UNSPECIFIED,
|
||||
signal: ExecRequest_SendSignal_SIGNAL_UNSPECIFIED,
|
||||
err: `unsupported exec signal "SIGNAL_UNSPECIFIED"`,
|
||||
},
|
||||
}
|
||||
|
|
@ -161,7 +161,9 @@ func TestExecSignalsProcess(t *testing.T) {
|
|||
require.NotNil(t, receiveExecResponse(t, stream).GetStarted())
|
||||
|
||||
stream.requests <- &ExecRequest{
|
||||
Type: &ExecRequest_Signal_{Signal: test.signal},
|
||||
Type: &ExecRequest_SendSignal_{
|
||||
SendSignal: &ExecRequest_SendSignal{Signal: test.signal},
|
||||
},
|
||||
}
|
||||
|
||||
if test.err != "" {
|
||||
|
|
@ -186,7 +188,9 @@ func TestExecSignalsProcessGroup(t *testing.T) {
|
|||
require.Equal(t, []byte("ready"), receiveExecResponse(t, stream).GetStandardOutput().GetData())
|
||||
|
||||
stream.requests <- &ExecRequest{
|
||||
Type: &ExecRequest_Signal_{Signal: ExecRequest_SIGNAL_SIGTERM},
|
||||
Type: &ExecRequest_SendSignal_{
|
||||
SendSignal: &ExecRequest_SendSignal{Signal: ExecRequest_SendSignal_SIGNAL_SIGTERM},
|
||||
},
|
||||
}
|
||||
|
||||
response := receiveExecResponse(t, stream)
|
||||
|
|
|
|||
|
|
@ -10,10 +10,14 @@ service Agent {
|
|||
}
|
||||
|
||||
message ExecRequest {
|
||||
enum Signal {
|
||||
SIGNAL_UNSPECIFIED = 0;
|
||||
SIGNAL_SIGTERM = 1;
|
||||
SIGNAL_SIGKILL = 2;
|
||||
message SendSignal {
|
||||
enum Signal {
|
||||
SIGNAL_UNSPECIFIED = 0;
|
||||
SIGNAL_SIGTERM = 1;
|
||||
SIGNAL_SIGKILL = 2;
|
||||
}
|
||||
|
||||
Signal signal = 1;
|
||||
}
|
||||
|
||||
message Command {
|
||||
|
|
@ -31,7 +35,7 @@ message ExecRequest {
|
|||
Command command = 1;
|
||||
IOChunk standard_input = 2;
|
||||
TerminalSize terminal_resize = 3;
|
||||
Signal signal = 4;
|
||||
SendSignal send_signal = 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue