From 935500f1f1d5218d3908758f626daab9bc944fd1 Mon Sep 17 00:00:00 2001 From: sawka Date: Sat, 25 Jun 2022 00:22:03 -0700 Subject: [PATCH] packet debugging with --debug --- main-mshell.go | 4 ++++ pkg/shexec/shexec.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/main-mshell.go b/main-mshell.go index 226c6452..7cb4836b 100644 --- a/main-mshell.go +++ b/main-mshell.go @@ -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 diff --git a/pkg/shexec/shexec.go b/pkg/shexec/shexec.go index 9bf98a56..74b98aa2 100644 --- a/pkg/shexec/shexec.go +++ b/pkg/shexec/shexec.go @@ -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 {