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:
1 parent
a9cb7156a3
commit
b7aaa23bd0
2 files changed
+3
-2
No files matched your search
@@ -371,7 +371,7 @@ func (app *app) exportFiles() {
|
|||||||
|
|
||||||
currSelections := app.nav.currSelections()
|
currSelections := app.nav.currSelections()
|
||||||
|
|
||||||
exportFiles(currFile, currSelections)
|
exportFiles(currFile, currSelections, app.nav.currDir().path)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is used to run a shell command. Modes are as follows:
|
// This function is used to run a shell command. Modes are as follows:
|
||||||
|
|||||||
@@ -177,12 +177,13 @@ func errCrossDevice(err error) bool {
|
|||||||
return err.(*os.LinkError).Err.(syscall.Errno) == syscall.EXDEV
|
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
|
envFile := f
|
||||||
envFiles := strings.Join(fs, gOpts.filesep)
|
envFiles := strings.Join(fs, gOpts.filesep)
|
||||||
|
|
||||||
os.Setenv("f", envFile)
|
os.Setenv("f", envFile)
|
||||||
os.Setenv("fs", envFiles)
|
os.Setenv("fs", envFiles)
|
||||||
|
os.Setenv("PWD", pwd)
|
||||||
|
|
||||||
if len(fs) == 0 {
|
if len(fs) == 0 {
|
||||||
os.Setenv("fx", envFile)
|
os.Setenv("fx", envFile)
|
||||||
|
|||||||
Reference in new issue
Block a user