Skip Menu |

Subject: tmpdir tries to change the current working directory
Date: Fri, 30 Dec 2016 02:10:31 -0500
To: rakudobug [...]
From: brian d foy <brian.d.foy [...]>
Setting the temporary directory apparently tries to change the current working directory, which I didn't expect. But, the documentation for tmpdir doesn't say what it does ( put "Tempdir is " ~ $*TMPDIR; { my $dir = '/Users/brian/.tmp'; unless my $rc = tmpdir( '/Users/brian/.not_there' ) { my $e = $rc.exception; put "unless: Error changing to $dir " ~ $e.^name ~ ': ' ~ $e.message; } CATCH { put "CATCH: Error changing to $dir " ~ .^name; } } I expected that tmpdir would return a Failure, and maybe it does if it doesn't change the current working directory. This may be related to ("chdir appears to throw exception immediately"). I would only expect things that want to create a temporary file to use the value of TMPDIR (say, like I don't need to know where that is and wouldn't want the current working directory to be there. I'd rather have the current working directory be the one where my input files are.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at