Open
Description
It would be great if system-lambda would also provide a facility to change the current working directory.
As far as I am aware, this requires two things at the same time:
a) setting the System property user.dir
.
b) Making a native call to chdir()
or fchdir()
The JRuby folks seem to have done something like this.
See also: https://stackoverflow.com/a/8204584/3554264
CAVEAT: The working directory is a process attribute, not a thread attribute. Changing it may have undesired results when running tests in parallel should these tests directly or indirectly rely on the current working directory in any way.
I would expect code to work like this:
@Test
void chDirExample() {
withCwd(Path.of(".").parent, () -> System.out.println(Pathof(".")));
}
Metadata
Metadata
Assignees
Labels
No labels