diff --git a/waveshell/main-waveshell.go b/waveshell/main-waveshell.go index 3889681f4..77f1511d0 100644 --- a/waveshell/main-waveshell.go +++ b/waveshell/main-waveshell.go @@ -14,6 +14,7 @@ import ( "github.com/wavetermdev/waveterm/waveshell/pkg/packet" "github.com/wavetermdev/waveterm/waveshell/pkg/server" "github.com/wavetermdev/waveterm/waveshell/pkg/shexec" + "github.com/wavetermdev/waveterm/waveshell/pkg/wlog" ) var BuildTime = "0" @@ -39,6 +40,7 @@ func handleSingle() { sender.Close() sender.WaitForDone() }() + wlog.LogConsumer = sender.SendLogPacket initPacket := shexec.MakeInitPacket() sender.SendPacket(initPacket) if len(os.Args) >= 3 && os.Args[2] == "--version" { @@ -133,11 +135,13 @@ func main() { return } else if firstArg == "--single" || firstArg == "--single-from-server" { base.ProcessType = base.ProcessType_WaveShellSingle + wlog.GlobalSubsystem = base.ProcessType_WaveShellSingle base.InitDebugLog("single") handleSingle() return } else if firstArg == "--server" { base.ProcessType = base.ProcessType_WaveShellServer + wlog.GlobalSubsystem = base.ProcessType_WaveShellServer base.InitDebugLog("server") rtnCode, err := server.RunServer() if err != nil { diff --git a/waveshell/pkg/base/base.go b/waveshell/pkg/base/base.go index 4a229bacf..82f042363 100644 --- a/waveshell/pkg/base/base.go +++ b/waveshell/pkg/base/base.go @@ -42,8 +42,8 @@ const LogRcFileName = "debug.rcfile" const ( ProcessType_Unknown = "unknown" ProcessType_WaveSrv = "wavesrv" - ProcessType_WaveShellSingle = "waveshell-single" - ProcessType_WaveShellServer = "waveshell-server" + ProcessType_WaveShellSingle = "wsh-1" + ProcessType_WaveShellServer = "wsh-s" ) // keys are sessionids (also the key RcFilesDirBaseName) diff --git a/waveshell/pkg/packet/packet.go b/waveshell/pkg/packet/packet.go index a19d4f850..72b5231d5 100644 --- a/waveshell/pkg/packet/packet.go +++ b/waveshell/pkg/packet/packet.go @@ -14,9 +14,9 @@ import ( "os" "reflect" "sync" - "time" "github.com/wavetermdev/waveterm/waveshell/pkg/base" + "github.com/wavetermdev/waveterm/waveshell/pkg/wlog" ) // single : run, >cmddata, >cmddone, data, <>dataack, = 2 && os.Args[1] == "--test" { log.Printf("running test fn\n") diff --git a/wavesrv/pkg/remote/remote.go b/wavesrv/pkg/remote/remote.go index f41c2afb0..e9b24f6cd 100644 --- a/wavesrv/pkg/remote/remote.go +++ b/wavesrv/pkg/remote/remote.go @@ -556,6 +556,9 @@ func (msh *MShellProc) GetShellPref() string { if msh.Remote.ShellPref == sstore.ShellTypePref_Detect { return msh.InitPkShellType } + if msh.Remote.ShellPref == "" { + return packet.ShellType_bash + } return msh.Remote.ShellPref } diff --git a/wavesrv/pkg/sstore/dbops.go b/wavesrv/pkg/sstore/dbops.go index 8666d5c4d..6b562a558 100644 --- a/wavesrv/pkg/sstore/dbops.go +++ b/wavesrv/pkg/sstore/dbops.go @@ -2868,6 +2868,9 @@ func GetRemoteActiveShells(ctx context.Context, remoteId string) ([]string, erro riArr := dbutil.SelectMapsGen[*RemoteInstance](tx, query, remoteId) shellTypeMap := make(map[string]bool) for _, ri := range riArr { + if ri.ShellType == "" { + continue + } shellTypeMap[ri.ShellType] = true } return utilfn.GetMapKeys(shellTypeMap), nil