@@ -45,7 +45,7 @@ func PollPostCreateStates(ctx context.Context, log logger, apiClient *api.API, u
4545 return fmt .Errorf ("connect to liveshare: %v" , err )
4646 }
4747
48- remoteSSHServerPort , _ , err := StartSSHServer (ctx , lsclient )
48+ remoteSSHServerPort , sshUser , err := StartSSHServer (ctx , lsclient , log )
4949 if err != nil {
5050 return fmt .Errorf ("error getting ssh server details: %v" , err )
5151 }
@@ -65,7 +65,7 @@ func PollPostCreateStates(ctx context.Context, log logger, apiClient *api.API, u
6565 case err := <- connClosed :
6666 return fmt .Errorf ("connection closed: %v" , err )
6767 case <- t .C :
68- states , err := getPostCreateOutput (ctx , tunnelPort , codespace )
68+ states , err := getPostCreateOutput (ctx , tunnelPort , codespace , sshUser )
6969 if err != nil {
7070 return fmt .Errorf ("get post create output: %v" , err )
7171 }
@@ -75,9 +75,9 @@ func PollPostCreateStates(ctx context.Context, log logger, apiClient *api.API, u
7575 }
7676}
7777
78- func getPostCreateOutput (ctx context.Context , tunnelPort int , codespace * api.Codespace ) ([]PostCreateState , error ) {
78+ func getPostCreateOutput (ctx context.Context , tunnelPort int , codespace * api.Codespace , user string ) ([]PostCreateState , error ) {
7979 stdout , err := RunCommand (
80- ctx , tunnelPort , sshDestination (codespace ),
80+ ctx , tunnelPort , sshDestination (codespace , user ),
8181 "cat /workspaces/.codespaces/shared/postCreateOutput.json" ,
8282 )
8383 if err != nil {
@@ -101,10 +101,6 @@ func getPostCreateOutput(ctx context.Context, tunnelPort int, codespace *api.Cod
101101}
102102
103103// TODO(josebalius): this won't be needed soon
104- func sshDestination (codespace * api.Codespace ) string {
105- user := "codespace"
106- if codespace .RepositoryNWO == "github/github" {
107- user = "root"
108- }
104+ func sshDestination (codespace * api.Codespace , user string ) string {
109105 return user + "@localhost"
110106}
0 commit comments