Skip to content

feat: add port-forward subcommand #1350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 18, 2022
Prev Previous commit
Next Next commit
chore: rename ExpandPath to ExpandRelativeHomePath
  • Loading branch information
deansheather committed May 18, 2022
commit f12ded0cdfc5bd9a8c120824a6fa0d13cd77e34f
8 changes: 4 additions & 4 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ func (a *agent) handleDial(ctx context.Context, label string, conn net.Conn) {
_ = writeError(xerrors.New("Unix forwarding is not supported from Windows workspaces"))
return
}
addr, err = ExpandPath(addr)
addr, err = ExpandRelativeHomePath(addr)
if err != nil {
_ = writeError(xerrors.Errorf("expand path %q: %w", addr, err))
return
Expand Down Expand Up @@ -760,9 +760,9 @@ func Bicopy(ctx context.Context, c1, c2 io.ReadWriteCloser) {
}
}

// ExpandPath expands the tilde at the beginning of a path to the current user's
// home directory and returns a full absolute path.
func ExpandPath(in string) (string, error) {
// ExpandRelativeHomePath expands the tilde at the beginning of a path to the
// current user's home directory and returns a full absolute path.
func ExpandRelativeHomePath(in string) (string, error) {
usr, err := user.Current()
if err != nil {
return "", xerrors.Errorf("get current user details: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion cli/portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func parsePort(in string) (uint16, error) {
}

func parseUnixPath(in string) (string, error) {
path, err := coderagent.ExpandPath(strings.TrimSpace(in))
path, err := coderagent.ExpandRelativeHomePath(strings.TrimSpace(in))
if err != nil {
return "", xerrors.Errorf("tidy path %q: %w", in, err)
}
Expand Down