Skip to content

Commit d281f22

Browse files
committed
Normalize expected path for chdir tests
The expected path comes from a simple string concatenation in shell, but `os.Getwd` appears to have the normalized working directory, so this can fail if any parent directory is a symlink.
1 parent 0426a5f commit d281f22

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/testing/chdir/chdir.go

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ argument.
1414
*/
1515
func main() {
1616
expectDir := os.Getenv("EXPECT_DIR")
17+
expectDir, err := filepath.EvalSymlinks(expectDir)
18+
if err != nil {
19+
log.Fatal(err)
20+
}
1721
cwd, err := os.Getwd()
1822
if err != nil {
1923
log.Fatal(err)

0 commit comments

Comments
 (0)