(silently bool, args ...string)
| 74 | } |
| 75 | |
| 76 | func (c *cliConnection) callCliCommand(silently bool, args ...string) ([]string, error) { |
| 77 | var ( |
| 78 | success bool |
| 79 | cmdOutput []string |
| 80 | callCoreCommandErr error |
| 81 | getOutputAndResetErr error |
| 82 | disableTerminalOutputErr error |
| 83 | ) |
| 84 | |
| 85 | _ = c.withClientDo(func(client *rpc.Client) error { |
| 86 | disableTerminalOutputErr = client.Call("CliRpcCmd.DisableTerminalOutput", silently, &success) |
| 87 | callCoreCommandErr = client.Call("CliRpcCmd.CallCoreCommand", args, &success) |
| 88 | getOutputAndResetErr = client.Call("CliRpcCmd.GetOutputAndReset", success, &cmdOutput) |
| 89 | |
| 90 | return nil |
| 91 | }) |
| 92 | |
| 93 | if disableTerminalOutputErr != nil { |
| 94 | return []string{}, disableTerminalOutputErr |
| 95 | } |
| 96 | |
| 97 | if callCoreCommandErr != nil { |
| 98 | return []string{}, callCoreCommandErr |
| 99 | } |
| 100 | |
| 101 | if !success { |
| 102 | return []string{}, errors.New("Error executing cli core command") |
| 103 | } |
| 104 | |
| 105 | if getOutputAndResetErr != nil { |
| 106 | return []string{}, errors.New("something completely unexpected happened") |
| 107 | } |
| 108 | |
| 109 | return cmdOutput, nil |
| 110 | } |
| 111 | |
| 112 | func (c *cliConnection) pingCLI() { |
| 113 | // call back to cf saying we have been setup |
no test coverage detected