mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
export PROMPT and PROMPT_VERSION, always start remote
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user