truncateOutput safely truncates output to maxOutputToModel, ensuring the result is valid UTF-8 even if the cut falls in the middle of a multi-byte character.
(output string)
| 234 | // ensuring the result is valid UTF-8 even if the cut falls in |
| 235 | // the middle of a multi-byte character. |
| 236 | func truncateOutput(output string) string { |
| 237 | if len(output) > maxOutputToModel { |
| 238 | output = strings.ToValidUTF8(output[:maxOutputToModel], "") |
| 239 | } |
| 240 | return output |
| 241 | } |
| 242 | |
| 243 | // waitForProcess waits for process completion using the |
| 244 | // blocking process output API instead of polling. |
no outgoing calls
no test coverage detected