| ... | @@ -43,6 +43,8 @@ test "chdir smoke test" { | ... | @@ -43,6 +43,8 @@ test "chdir smoke test" { |
| 43 | // Next, change current working directory to one level above | 43 | // Next, change current working directory to one level above |
| 44 | const parent = fs.path.dirname(old_cwd) orelse unreachable; // old_cwd should be absolute | 44 | const parent = fs.path.dirname(old_cwd) orelse unreachable; // old_cwd should be absolute |
| 45 | try os.chdir(parent); | 45 | try os.chdir(parent); |
| | 46 | // Restore cwd because process may have other tests that do not tolerate chdir. |
| | 47 | defer os.chdir(old_cwd) catch unreachable; |
| 46 | var new_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined; | 48 | var new_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined; |
| 47 | const new_cwd = try os.getcwd(new_cwd_buf[0..]); | 49 | const new_cwd = try os.getcwd(new_cwd_buf[0..]); |
| 48 | expect(mem.eql(u8, parent, new_cwd)); | 50 | expect(mem.eql(u8, parent, new_cwd)); |