mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-04 18:59:08 +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)
|
stderrPacketCh := packet.PacketParser(stderrReader)
|
||||||
packetCh := packet.CombinePacketParsers(stdoutPacketCh, stderrPacketCh)
|
packetCh := packet.CombinePacketParsers(stdoutPacketCh, stderrPacketCh)
|
||||||
sender := packet.MakePacketSender(inputWriter)
|
sender := packet.MakePacketSender(inputWriter)
|
||||||
|
versionOk := false
|
||||||
for pk := range packetCh {
|
for pk := range packetCh {
|
||||||
if pk.GetType() == packet.RawPacketStr {
|
if pk.GetType() == packet.RawPacketStr {
|
||||||
rawPk := pk.(*packet.RawPacketType)
|
rawPk := pk.(*packet.RawPacketType)
|
||||||
@ -314,9 +315,13 @@ func RunClientSSHCommandAndWait(opts *ClientOpts) (*packet.CmdDonePacketType, er
|
|||||||
if initPk.Version != "0.1.0" {
|
if initPk.Version != "0.1.0" {
|
||||||
return nil, fmt.Errorf("invalid remote mshell version 'v%s', must be v0.1.0", initPk.Version)
|
return nil, fmt.Errorf("invalid remote mshell version 'v%s', must be v0.1.0", initPk.Version)
|
||||||
}
|
}
|
||||||
|
versionOk = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !versionOk {
|
||||||
|
return nil, fmt.Errorf("did not receive version from remote mshell")
|
||||||
|
}
|
||||||
runPacket := opts.MakeRunPacket()
|
runPacket := opts.MakeRunPacket()
|
||||||
sender.SendPacket(runPacket)
|
sender.SendPacket(runPacket)
|
||||||
if opts.Debug {
|
if opts.Debug {
|
||||||
|
Loading…
Reference in New Issue
Block a user