MCPcopy Create free account
hub / github.com/jetkvm/kvm / rpcSetSerialCommandHistory

Function rpcSetSerialCommandHistory

jsonrpc.go:932–948  ·  view source on GitHub ↗
(commandHistory []string)

Source from the content-addressed store, hash-verified

930}
931
932func rpcSetSerialCommandHistory(commandHistory []string) error {
933 logger.Trace().Str("path", SerialCommandHistoryPath).Msg("Saving serial command history")
934
935 file, err := os.Create(SerialCommandHistoryPath)
936 if err != nil {
937 return fmt.Errorf("failed to create SerialCommandHistory file: %w", err)
938 }
939 defer file.Close()
940
941 encoder := json.NewEncoder(file)
942 encoder.SetIndent("", " ")
943 if err := encoder.Encode(commandHistory); err != nil {
944 return fmt.Errorf("failed to encode SerialCommandHistory: %w", err)
945 }
946
947 return nil
948}
949
950func rpcDeleteSerialCommandHistory() error {
951 logger.Trace().Str("path", SerialCommandHistoryPath).Msg("Deleting serial command history")

Callers

nothing calls this directly

Calls 4

TraceMethod · 0.80
ErrorfMethod · 0.80
EncodeMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected