Skip to content

Commit

Permalink
Normalize expected path for chdir tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
QuLogic committed Dec 31, 2024
1 parent 0426a5f commit d281f22
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/testing/chdir/chdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ argument.
*/
func main() {
expectDir := os.Getenv("EXPECT_DIR")
expectDir, err := filepath.EvalSymlinks(expectDir)
if err != nil {
log.Fatal(err)
}
cwd, err := os.Getwd()
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit d281f22

Please sign in to comment.