Skip to content

Commit

Permalink
atlasexec: change workingDir property instead of creating new client
Browse files Browse the repository at this point in the history
  • Loading branch information
luantranminh committed Jun 17, 2024
1 parent b26beac commit 954d50a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions atlasexec/atlas.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,12 @@ func NewClient(workingDir, execPath string) (_ *Client, err error) {
// })
// return err
// })
func (c Client) WithWorkDir(dir string, fn func(*Client) error) error {
func (c *Client) WithWorkDir(dir string, fn func(*Client) error) error {
wd := c.workingDir
defer func() { c.workingDir = wd }()
c.workingDir = dir
return fn(&c)
err := fn(c)
return err
}

// Login runs the 'login' command.
Expand Down

0 comments on commit 954d50a

Please sign in to comment.