( outputCapture OutputCapture, terminalOutputSwitch TerminalOutputSwitch, cliConfig coreconfig.Repository, repoLocator api.RepositoryLocator, newCmdRunner CommandRunner, logger trace.Printer, w io.Writer, rpcServer *rpc.Server, )
| 59 | } |
| 60 | |
| 61 | func NewRpcService( |
| 62 | outputCapture OutputCapture, |
| 63 | terminalOutputSwitch TerminalOutputSwitch, |
| 64 | cliConfig coreconfig.Repository, |
| 65 | repoLocator api.RepositoryLocator, |
| 66 | newCmdRunner CommandRunner, |
| 67 | logger trace.Printer, |
| 68 | w io.Writer, |
| 69 | rpcServer *rpc.Server, |
| 70 | ) (*CliRpcService, error) { |
| 71 | rpcService := &CliRpcService{ |
| 72 | Server: rpcServer, |
| 73 | RpcCmd: &CliRpcCmd{ |
| 74 | PluginMetadata: &plugin.PluginMetadata{}, |
| 75 | MetadataMutex: &sync.RWMutex{}, |
| 76 | outputCapture: outputCapture, |
| 77 | terminalOutputSwitch: terminalOutputSwitch, |
| 78 | cliConfig: cliConfig, |
| 79 | repoLocator: repoLocator, |
| 80 | newCmdRunner: newCmdRunner, |
| 81 | logger: logger, |
| 82 | outputBucket: &bytes.Buffer{}, |
| 83 | stdout: w, |
| 84 | }, |
| 85 | } |
| 86 | |
| 87 | err := rpcService.Server.Register(rpcService.RpcCmd) |
| 88 | if err != nil { |
| 89 | return nil, err |
| 90 | } |
| 91 | |
| 92 | return rpcService, nil |
| 93 | } |
| 94 | |
| 95 | func (cli *CliRpcService) Stop() { |
| 96 | close(cli.stopCh) |
no test coverage detected