New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chdir appears to throw exception immediately #5921
Comments
From @briandfoyUsing chdir with a non-existent directory appear to throw the exception If the directory change is successful then the IO::Path representing Here's what I was doing. I expected to get a Failure object back from put 'Current working directory is ' ~ $*CWD; my $file = '/not-there.txt'; unless my $r = chdir $file { say "Cwd is now " ~ $*CWD; Instead, CATCH handles the immediately thrown exception: Current working directory is /Users/brian/Dropbox/~~Writing/Perl Actually thrown at: |
From @zoffixznetOn Tue, 27 Dec 2016 13:28:19 -0800, comdog wrote:
A bit of a discussion for why chdir throws: https://irclog.perlgeek.de/perl6-dev/2016-12-28#i_13810888 But on further inspection, I see most of IO routines intercept Failures and throw them; search for ".throw" in https://github.com/rakudo/rakudo/blob/nom/src/core/IO/Path.pm and and https://github.com/rakudo/rakudo/blob/nom/src/core/io_operators.pm Yet the docs say they fail() and not throw. So it makes me wonder if it's a design decision to abandoning the Failure mechanism on all of IO routines? |
The RT System itself - Status changed from 'new' to 'open' |
From @zoffixznetSome comments from moritz: https://irclog.perlgeek.de/perl6-dev/2016-12-28#i_13813983 I also notice our *subs* throw, while *methods* fail(). The subs call the methods, check for failures and throw if detected. Based on what I see in the code sub move() appears to throw on anything which is not X::IO::Copy|X::IO::Unlink, and for those two it fails... and IO::Path doesn't provide a .move method at all. So it all seems to be pretty messy and in need of consistency. We just need to decide what the behaviour should be. |
From @lizmatWelcome to the world of the newio branch
|
From @zoffixznetOn Tue, 27 Dec 2016 13:28:19 -0800, comdog wrote:
Thanks for the report. This was fixed some time in 2017.04 release. - IO grant |
@zoffixznet - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#130418 (status was 'resolved')
Searchable as RT130418$
The text was updated successfully, but these errors were encountered: