Export $PWD to shell (#591)

Most shells use $PWD to show the right working directory when it's a
symlink. Without it, they'd fall back to the absolute path instead.
This commit is contained in:
SeerLite authored and GitHub committed 2021-03-19 13:58:10 +03:00
1 parent a9cb7156a3
commit b7aaa23bd0
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -177,12 +177,13 @@ func errCrossDevice(err error) bool {
return err.(*os.LinkError).Err.(syscall.Errno) == syscall.EXDEV
}
func exportFiles(f string, fs []string) {
func exportFiles(f string, fs []string, pwd string) {
envFile := f
envFiles := strings.Join(fs, gOpts.filesep)
os.Setenv("f", envFile)
os.Setenv("fs", envFiles)
os.Setenv("PWD", pwd)
if len(fs) == 0 {
os.Setenv("fx", envFile)