diff --git a/pkg/cmdrunner/cmdrunner.go b/pkg/cmdrunner/cmdrunner.go index 40ca70385..39d7f1627 100644 --- a/pkg/cmdrunner/cmdrunner.go +++ b/pkg/cmdrunner/cmdrunner.go @@ -902,7 +902,7 @@ func RemoteNewCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (ss if editArgs.Color != "" { r.RemoteOpts = &sstore.RemoteOptsType{Color: editArgs.Color} } - err = remote.AddRemote(ctx, r) + err = remote.AddRemote(ctx, r, true) if err != nil { return makeRemoteEditErrorReturn_new(visualEdit, fmt.Errorf("cannot create remote %q: %v", r.RemoteCanonicalName, err)) } diff --git a/pkg/remote/remote.go b/pkg/remote/remote.go index 662f14a68..c7cdd9dc9 100644 --- a/pkg/remote/remote.go +++ b/pkg/remote/remote.go @@ -283,7 +283,7 @@ func ReadRemotePty(ctx context.Context, remoteId string) (int64, []byte, error) return offset, barr, nil } -func AddRemote(ctx context.Context, r *sstore.RemoteType) error { +func AddRemote(ctx context.Context, r *sstore.RemoteType, shouldStart bool) error { GlobalStore.Lock.Lock() defer GlobalStore.Lock.Unlock() @@ -306,7 +306,7 @@ func AddRemote(ctx context.Context, r *sstore.RemoteType) error { newMsh := MakeMShell(r) GlobalStore.Map[r.RemoteId] = newMsh go newMsh.NotifyRemoteUpdate() - if r.ConnectMode == sstore.ConnectModeStartup { + if shouldStart { go newMsh.Launch() } return nil @@ -988,8 +988,8 @@ func addScVarsToState(state *packet.ShellState) *packet.ShellState { } rtn := *state envMap := shexec.DeclMapFromState(&rtn) - envMap["PROMPT"] = &shexec.DeclareDeclType{Name: "PROMPT", Value: "1"} - envMap["PROMPT_VERSION"] = &shexec.DeclareDeclType{Name: "PROMPT_VERSION", Value: scbase.PromptVersion} + envMap["PROMPT"] = &shexec.DeclareDeclType{Name: "PROMPT", Value: "1", Args: "x"} + envMap["PROMPT_VERSION"] = &shexec.DeclareDeclType{Name: "PROMPT_VERSION", Value: scbase.PromptVersion, Args: "x"} rtn.ShellVars = shexec.SerializeDeclMap(envMap) return &rtn }