mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-03 18:47:56 +01:00
check for input termination before init packet
This commit is contained in:
parent
fec7721e32
commit
e8ae01efae
@ -303,6 +303,7 @@ func RunClientSSHCommandAndWait(opts *ClientOpts) (*packet.CmdDonePacketType, er
|
||||
stderrPacketCh := packet.PacketParser(stderrReader)
|
||||
packetCh := packet.CombinePacketParsers(stdoutPacketCh, stderrPacketCh)
|
||||
sender := packet.MakePacketSender(inputWriter)
|
||||
versionOk := false
|
||||
for pk := range packetCh {
|
||||
if pk.GetType() == packet.RawPacketStr {
|
||||
rawPk := pk.(*packet.RawPacketType)
|
||||
@ -314,9 +315,13 @@ func RunClientSSHCommandAndWait(opts *ClientOpts) (*packet.CmdDonePacketType, er
|
||||
if initPk.Version != "0.1.0" {
|
||||
return nil, fmt.Errorf("invalid remote mshell version 'v%s', must be v0.1.0", initPk.Version)
|
||||
}
|
||||
versionOk = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !versionOk {
|
||||
return nil, fmt.Errorf("did not receive version from remote mshell")
|
||||
}
|
||||
runPacket := opts.MakeRunPacket()
|
||||
sender.SendPacket(runPacket)
|
||||
if opts.Debug {
|
||||
|
Loading…
Reference in New Issue
Block a user