god damn, still a lot code to fix, because the cli lib update

master
codeskyblue 8 years ago
parent f92a01f630
commit b86f4c939a

@ -127,7 +127,7 @@ func ActionAdd(ctx *cli.Context, client pb.GoSuvClient) {
req := new(pb.ProgramInfo) req := new(pb.ProgramInfo)
req.Name = ctx.String("name") req.Name = ctx.String("name")
req.Directory = dir req.Directory = dir
req.Command = append([]string{cmdPath}, ctx.Args().Tail()...) req.Command = strings.Join(append([]string{cmdPath}, ctx.Args().Tail()...), " ")
req.Environ = ctx.StringSlice("env") req.Environ = ctx.StringSlice("env")
res, err := client.Create(context.Background(), req) res, err := client.Create(context.Background(), req)

@ -34,29 +34,36 @@ var _ = proto.Marshal
var _ = fmt.Errorf var _ = fmt.Errorf
var _ = math.Inf var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
const _ = proto.ProtoPackageIsVersion1
type NopRequest struct { type NopRequest struct {
} }
func (m *NopRequest) Reset() { *m = NopRequest{} } func (m *NopRequest) Reset() { *m = NopRequest{} }
func (m *NopRequest) String() string { return proto.CompactTextString(m) } func (m *NopRequest) String() string { return proto.CompactTextString(m) }
func (*NopRequest) ProtoMessage() {} func (*NopRequest) ProtoMessage() {}
func (*NopRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type Response struct { type Response struct {
Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
} }
func (m *Response) Reset() { *m = Response{} } func (m *Response) Reset() { *m = Response{} }
func (m *Response) String() string { return proto.CompactTextString(m) } func (m *Response) String() string { return proto.CompactTextString(m) }
func (*Response) ProtoMessage() {} func (*Response) ProtoMessage() {}
func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
type Request struct { type Request struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
} }
func (m *Request) Reset() { *m = Request{} } func (m *Request) Reset() { *m = Request{} }
func (m *Request) String() string { return proto.CompactTextString(m) } func (m *Request) String() string { return proto.CompactTextString(m) }
func (*Request) ProtoMessage() {} func (*Request) ProtoMessage() {}
func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
type TailRequest struct { type TailRequest struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
@ -64,20 +71,22 @@ type TailRequest struct {
Follow bool `protobuf:"varint,3,opt,name=follow" json:"follow,omitempty"` Follow bool `protobuf:"varint,3,opt,name=follow" json:"follow,omitempty"`
} }
func (m *TailRequest) Reset() { *m = TailRequest{} } func (m *TailRequest) Reset() { *m = TailRequest{} }
func (m *TailRequest) String() string { return proto.CompactTextString(m) } func (m *TailRequest) String() string { return proto.CompactTextString(m) }
func (*TailRequest) ProtoMessage() {} func (*TailRequest) ProtoMessage() {}
func (*TailRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
type ProgramInfo struct { type ProgramInfo struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
Directory string `protobuf:"bytes,3,opt,name=directory" json:"directory,omitempty"` Directory string `protobuf:"bytes,3,opt,name=directory" json:"directory,omitempty"`
Command []string `protobuf:"bytes,2,rep,name=command" json:"command,omitempty"` Command string `protobuf:"bytes,2,opt,name=command" json:"command,omitempty"`
Environ []string `protobuf:"bytes,4,rep,name=environ" json:"environ,omitempty"` Environ []string `protobuf:"bytes,4,rep,name=environ" json:"environ,omitempty"`
} }
func (m *ProgramInfo) Reset() { *m = ProgramInfo{} } func (m *ProgramInfo) Reset() { *m = ProgramInfo{} }
func (m *ProgramInfo) String() string { return proto.CompactTextString(m) } func (m *ProgramInfo) String() string { return proto.CompactTextString(m) }
func (*ProgramInfo) ProtoMessage() {} func (*ProgramInfo) ProtoMessage() {}
func (*ProgramInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
type ProgramStatus struct { type ProgramStatus struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
@ -85,17 +94,19 @@ type ProgramStatus struct {
Extra string `protobuf:"bytes,3,opt,name=extra" json:"extra,omitempty"` Extra string `protobuf:"bytes,3,opt,name=extra" json:"extra,omitempty"`
} }
func (m *ProgramStatus) Reset() { *m = ProgramStatus{} } func (m *ProgramStatus) Reset() { *m = ProgramStatus{} }
func (m *ProgramStatus) String() string { return proto.CompactTextString(m) } func (m *ProgramStatus) String() string { return proto.CompactTextString(m) }
func (*ProgramStatus) ProtoMessage() {} func (*ProgramStatus) ProtoMessage() {}
func (*ProgramStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
type StatusResponse struct { type StatusResponse struct {
Programs []*ProgramStatus `protobuf:"bytes,1,rep,name=programs" json:"programs,omitempty"` Programs []*ProgramStatus `protobuf:"bytes,1,rep,name=programs" json:"programs,omitempty"`
} }
func (m *StatusResponse) Reset() { *m = StatusResponse{} } func (m *StatusResponse) Reset() { *m = StatusResponse{} }
func (m *StatusResponse) String() string { return proto.CompactTextString(m) } func (m *StatusResponse) String() string { return proto.CompactTextString(m) }
func (*StatusResponse) ProtoMessage() {} func (*StatusResponse) ProtoMessage() {}
func (*StatusResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *StatusResponse) GetPrograms() []*ProgramStatus { func (m *StatusResponse) GetPrograms() []*ProgramStatus {
if m != nil { if m != nil {
@ -108,14 +119,30 @@ type LogLine struct {
Line string `protobuf:"bytes,1,opt,name=line" json:"line,omitempty"` Line string `protobuf:"bytes,1,opt,name=line" json:"line,omitempty"`
} }
func (m *LogLine) Reset() { *m = LogLine{} } func (m *LogLine) Reset() { *m = LogLine{} }
func (m *LogLine) String() string { return proto.CompactTextString(m) } func (m *LogLine) String() string { return proto.CompactTextString(m) }
func (*LogLine) ProtoMessage() {} func (*LogLine) ProtoMessage() {}
func (*LogLine) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func init() {
proto.RegisterType((*NopRequest)(nil), "gosuvpb.NopRequest")
proto.RegisterType((*Response)(nil), "gosuvpb.Response")
proto.RegisterType((*Request)(nil), "gosuvpb.Request")
proto.RegisterType((*TailRequest)(nil), "gosuvpb.TailRequest")
proto.RegisterType((*ProgramInfo)(nil), "gosuvpb.ProgramInfo")
proto.RegisterType((*ProgramStatus)(nil), "gosuvpb.ProgramStatus")
proto.RegisterType((*StatusResponse)(nil), "gosuvpb.StatusResponse")
proto.RegisterType((*LogLine)(nil), "gosuvpb.LogLine")
}
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ context.Context var _ context.Context
var _ grpc.ClientConn var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion1
// Client API for GoSuv service // Client API for GoSuv service
type GoSuvClient interface { type GoSuvClient interface {
@ -425,3 +452,33 @@ var _Program_serviceDesc = grpc.ServiceDesc{
}, },
}, },
} }
var fileDescriptor0 = []byte{
// 403 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x53, 0x4d, 0x6f, 0xd3, 0x40,
0x10, 0xad, 0x89, 0x3f, 0xc7, 0x6d, 0xa1, 0x0b, 0xa2, 0x56, 0x4f, 0xd5, 0x9e, 0xc2, 0x01, 0x83,
0x5c, 0x0e, 0x08, 0xb8, 0x71, 0x40, 0x48, 0x15, 0xaa, 0x62, 0xc4, 0x7d, 0x13, 0x4f, 0x8d, 0x25,
0x7b, 0xc7, 0xec, 0xae, 0x5d, 0xf8, 0x91, 0xfc, 0x08, 0xfe, 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f5, 0x74, 0x27, 0xb1, 0x58, 0x86, 0xc9, 0xd3, 0x78, 0x0a, 0x33, 0xbe, 0x33, 0xa8, 0x4f,
0xe8, 0x92, 0xf2, 0xcb, 0x42, 0x0e, 0x59, 0x96, 0xdd, 0xef, 0x38, 0x33, 0xf9, 0x65, 0x81, 0xf3,
0x81, 0xd2, 0xa6, 0x65, 0xaf, 0xc0, 0x4f, 0xbf, 0x36, 0x26, 0xa3, 0x1b, 0xc9, 0x1e, 0xcf, 0x32,
0xb7, 0x07, 0x39, 0x3b, 0x99, 0x9b, 0x7f, 0x0c, 0xf0, 0x03, 0x76, 0x01, 0xde, 0x17, 0x54, 0xba,
0xa0, 0xff, 0x21, 0xbd, 0x06, 0x77, 0x0a, 0x60, 0x27, 0xe7, 0x74, 0x6e, 0xde, 0xdd, 0x77, 0x18,
0xe7, 0xbe, 0x57, 0x28, 0x0c, 0xb2, 0x27, 0xf7, 0x37, 0xed, 0x8f, 0xb4, 0x73, 0x5c, 0xf2, 0xd3,
0x02, 0x6f, 0x02, 0xb1, 0x18, 0x9c, 0x4e, 0x54, 0x19, 0xf6, 0x68, 0x0b, 0xf9, 0x0f, 0xab, 0xcf,
0xc1, 0x4e, 0x0d, 0xd5, 0xfb, 0xc2, 0x5f, 0x80, 0xbb, 0xc2, 0x8a, 0x5a, 0xdc, 0x97, 0x90, 0x80,
0xdd, 0xbf, 0xd0, 0xad, 0x75, 0xb6, 0x1e, 0xec, 0xd9, 0xad, 0xc8, 0x74, 0x3d, 0x7e, 0xf0, 0xd2,
0x5a, 0xbb, 0xc3, 0x77, 0x73, 0xf1, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x35, 0x2e, 0xee, 0x46,
0x03, 0x00, 0x00,
}

@ -21,7 +21,7 @@ message TailRequest {
message ProgramInfo { message ProgramInfo {
string name = 1; string name = 1;
string directory = 3; string directory = 3;
repeated string command = 2; string command = 2;
repeated string environ = 4; repeated string environ = 4;
} }

@ -30,7 +30,7 @@ const (
type ProgramInfo struct { type ProgramInfo struct {
Name string `json:"name"` Name string `json:"name"`
Command []string `json:"command"` Command string `json:"command"`
Environ []string `json:"environ"` Environ []string `json:"environ"`
Dir string `json:"directory"` Dir string `json:"directory"`
AutoStart bool `json:"autostart"` // change to *bool, which support unexpected AutoStart bool `json:"autostart"` // change to *bool, which support unexpected
@ -40,7 +40,8 @@ type ProgramInfo struct {
} }
func (p *ProgramInfo) buildCmd() *kexec.KCommand { func (p *ProgramInfo) buildCmd() *kexec.KCommand {
cmd := kexec.Command(p.Command[0], p.Command[1:]...) cmd := kexec.CommandString(p.Command) // Not tested here, I think it should work
// cmd := kexec.Command(p.Command[0], p.Command[1:]...)
cmd.Dir = p.Dir cmd.Dir = p.Dir
cmd.Env = append(os.Environ(), p.Environ...) cmd.Env = append(os.Environ(), p.Environ...)
return cmd return cmd

Loading…
Cancel
Save