export PROMPT and PROMPT_VERSION, always start remote

This commit is contained in:
sawka 2023-01-23 13:28:00 -08:00
parent f8c675c3e7
commit 5914e57afc
2 changed files with 5 additions and 5 deletions

View File

@ -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))
}

View File

@ -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
}