Return to original directory when Chdir is used
- Dominant language
- Go
- Stars
- 14
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
Some functions require changing the working directory. In older versions, we would use the `Dir` (working directory) field of `exec.Command`, but at some point it was changed to do `os.Chdir()` when needed.
This isn't a a problem when performing actions on the command line, since the runtime doesn't affect the working directory of the shell that called it. It does cause an issue when gin-cli functions are used by other projects, since they may call a function like `CloneRepo()` to clone a repository and on return the working directory of the calling program has changed.
This should be fixed for all functions that can be used externally, either by going back to setting the `Dir` of external commands and adjusting paths, or by deferring a `os.Chdir()` that restores the original working directory.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.