On Thu, 29 Dec 2016 23:11:38 -0800, comdog wrote:
> 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
> (https://docs.perl6.org/routine/tmpdir).
> 
> 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
> https://rt.perl.org/Ticket/Display.html?id=130418
> ("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
> https://github.com/perlpilot/p6-File-Temp). 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.

Thank you for the report.

&tmpdir was removed from Rakudo's implementation and the issue described in 
this ticket no longer applies.

-- IO grant

Reply via email to