()
| 118 | } |
| 119 | |
| 120 | func (jm *JobManager) sendJobExited() { |
| 121 | jm.lock.Lock() |
| 122 | attachedClient := jm.attachedClient |
| 123 | cmd := jm.Cmd |
| 124 | jm.lock.Unlock() |
| 125 | |
| 126 | if attachedClient == nil { |
| 127 | log.Printf("sendJobExited: no attached client, exit notification not sent\n") |
| 128 | return |
| 129 | } |
| 130 | if attachedClient.WshRpc == nil { |
| 131 | log.Printf("sendJobExited: no wsh rpc connection, exit notification not sent\n") |
| 132 | return |
| 133 | } |
| 134 | if cmd == nil { |
| 135 | log.Printf("sendJobExited: no cmd, exit notification not sent\n") |
| 136 | return |
| 137 | } |
| 138 | |
| 139 | exited, exitData := cmd.GetExitInfo() |
| 140 | if !exited || exitData == nil { |
| 141 | log.Printf("sendJobExited: process not exited yet\n") |
| 142 | return |
| 143 | } |
| 144 | |
| 145 | exitCodeStr := "nil" |
| 146 | if exitData.ExitCode != nil { |
| 147 | exitCodeStr = fmt.Sprintf("%d", *exitData.ExitCode) |
| 148 | } |
| 149 | log.Printf("sendJobExited: sending exit notification to main server exitcode=%s signal=%s\n", exitCodeStr, exitData.ExitSignal) |
| 150 | err := wshclient.JobCmdExitedCommand(attachedClient.WshRpc, *exitData, nil) |
| 151 | if err != nil { |
| 152 | log.Printf("sendJobExited: error sending exit notification: %v\n", err) |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | func (jm *JobManager) GetJobAuthInfo() (string, string) { |
| 157 | jm.lock.Lock() |
no test coverage detected