mirror of
https://github.com/jixishi/SerialTerminalForWindowsTerminal.git
synced 2026-06-16 00:52:44 +00:00
refactor: extract internal/session and eliminate I/O globals
Move serial port, trzsz filter, and pipe lifecycle into internal/session.SerialSession. Replace 8 global I/O vars (serialPort, trzszFilter, stdinPipe, stdoutPipe, clientIn, clientOut, termch, termchOnce) with single sess variable. Delete utils.go. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -6,13 +6,17 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/jixishi/SerialTerminalForWindowsTerminal/internal/event"
|
||||
"github.com/jixishi/SerialTerminalForWindowsTerminal/internal/session"
|
||||
"github.com/jixishi/SerialTerminalForWindowsTerminal/pkg/forward"
|
||||
"github.com/jixishi/SerialTerminalForWindowsTerminal/pkg/luaplugin"
|
||||
)
|
||||
|
||||
func setupTestPipes() {
|
||||
if sess == nil {
|
||||
sess = &session.SerialSession{}
|
||||
}
|
||||
var cr *io.PipeReader
|
||||
cr, stdinPipe = io.Pipe()
|
||||
cr, sess.StdinPipe = io.Pipe()
|
||||
go func() {
|
||||
buf := make([]byte, 4096)
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user