MCPcopy
hub / github.com/wavetermdev/waveterm / resetTerminalState

Function resetTerminalState

pkg/jobcontroller/jobcontroller.go:1541–1557  ·  view source on GitHub ↗
(logCtx context.Context, blockId string)

Source from the content-addressed store, hash-verified

1539}
1540
1541func resetTerminalState(logCtx context.Context, blockId string) {
1542 if blockId == "" {
1543 return
1544 }
1545 ctx, cancelFn := context.WithTimeout(context.Background(), DefaultTimeout)
1546 defer cancelFn()
1547 if isFileEmpty(ctx, blockId) {
1548 return
1549 }
1550 blocklogger.Debugf(logCtx, "[conndebug] resetTerminalState: resetting terminal state for block\n")
1551 resetSeq := shellutil.GetTerminalResetSeq()
1552 resetSeq += "\r\n"
1553 err := doWFSAppend(ctx, waveobj.MakeORef(waveobj.OType_Block, blockId), JobOutputFileName, []byte(resetSeq))
1554 if err != nil {
1555 log.Printf("error appending terminal reset to block file: %v\n", err)
1556 }
1557}
1558
1559func isFileEmpty(ctx context.Context, blockId string) bool {
1560 if blockId == "" {

Callers 3

HandleCmdJobExitedFunction · 0.85

Calls 5

DebugfFunction · 0.92
GetTerminalResetSeqFunction · 0.92
MakeORefFunction · 0.92
isFileEmptyFunction · 0.85
doWFSAppendFunction · 0.85

Tested by

no test coverage detected