FS action bugfixes
[scpubgit/DKit.git] / lib / DX / Lib / FS / Action / SetPathMode.pm
index f7cba83..0753e9b 100644 (file)
@@ -2,10 +2,11 @@ package DX::Lib::FS::Action::SetPathMode;
 
 use Moo;
 
-has path_status => (is => 'ro', required => 1);
+has path_status => (is => 'ro', required => 1, handles => [ 'path' ]);
 has mode => (is => 'ro', required => 1);
 
 with 'DX::Role::Action';
+with 'DX::Lib::FS::Role::RunOn';
 
 sub expected_effect {
   my ($self) = @_;
@@ -15,9 +16,8 @@ sub expected_effect {
 
 sub _do_run {
   my ($self) = @_;
-  chmod oct($self->mode), $self->path_status->path
-    or die "Failed to chmod ${\$self->path_status->path} to ${\$self->mode}: $!";
-  +(path_status => $self->path_status);
+  $self->_call_guts(set_path_mode => $self->mode);
+  +(path_status => $self->path);
 }
 
 1;