packet debugging with --debug

This commit is contained in:
sawka 2022-06-25 00:22:03 -07:00
parent 43ed95f8fc
commit 935500f1f1
2 changed files with 8 additions and 0 deletions

View File

@ -298,6 +298,10 @@ func parseClientOpts() (*shexec.ClientOpts, error) {
opts.Cwd = iter.Next()
continue
}
if argStr == "--debug" {
opts.Debug = true
continue
}
}
if opts.IsSSH {
// parse SSH opts

View File

@ -219,6 +219,7 @@ type ClientOpts struct {
Command string
Fds []packet.RemoteFd
Cwd string
Debug bool
}
func (opts *ClientOpts) MakeRunPacket() *packet.RunPacketType {
@ -318,6 +319,9 @@ func RunClientSSHCommandAndWait(opts *ClientOpts) (*packet.CmdDonePacketType, er
}
runPacket := opts.MakeRunPacket()
sender.SendPacket(runPacket)
if opts.Debug {
cmd.Multiplexer.Debug = true
}
remoteDonePacket := cmd.Multiplexer.RunIOAndWait(packetCh, sender, false, true, true)
donePacket := cmd.WaitForCommand()
if remoteDonePacket != nil {