mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
pass realoffset back in header for /api/ptyout
This commit is contained in:
parent
3639e2454d
commit
c3961891ce
@ -9,6 +9,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@ -216,7 +217,7 @@ func HandleGetPtyOut(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(fmt.Sprintf("invalid cmdid: %v", err)))
|
||||
return
|
||||
}
|
||||
_, data, err := sstore.ReadFullPtyOutFile(r.Context(), sessionId, cmdId)
|
||||
realOffset, data, err := sstore.ReadFullPtyOutFile(r.Context(), sessionId, cmdId)
|
||||
if err != nil {
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
@ -226,6 +227,7 @@ func HandleGetPtyOut(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(fmt.Sprintf("error reading ptyout file: %v", err)))
|
||||
return
|
||||
}
|
||||
w.Header().Set("X-PtyDataOffset", strconv.FormatInt(realOffset, 10))
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write(data)
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ func AppendToCmdPtyBlob(ctx context.Context, sessionId string, cmdId string, dat
|
||||
return nil
|
||||
}
|
||||
|
||||
// returns (offset, data, err)
|
||||
func ReadFullPtyOutFile(ctx context.Context, sessionId string, cmdId string) (int64, []byte, error) {
|
||||
ptyOutFileName, err := scbase.PtyOutFile(sessionId, cmdId)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user