动态指令增加录屏

This commit is contained in:
dushixiang
2021-02-07 17:46:47 +08:00
committed by dushixiang
parent d72ab4e21e
commit b4421b1b56
9 changed files with 61 additions and 90 deletions

View File

@ -75,7 +75,14 @@ func (ret *NextTerminal) Write(p []byte) (int, error) {
}
func (ret *NextTerminal) Read() ([]byte, int, error) {
return ret.NextWriter.Read()
bytes, n, err := ret.NextWriter.Read()
if err != nil {
return nil, 0, err
}
if ret.Recorder != nil && n > 0 {
_ = ret.Recorder.WriteData(string(bytes))
}
return bytes, n, nil
}
func (ret *NextTerminal) Close() error {

View File

@ -108,8 +108,8 @@ func CreateRecording(recordingPath string, h int, w int) (*Recorder, error) {
header := &Header{
Title: "",
Version: 2,
Height: h,
Width: w,
Height: 42,
Width: 150,
Env: Env{Shell: "/bin/bash", Term: "xterm-256color"},
Timestamp: int(time.Now().Unix()),
}