Skip to content

Commit

Permalink
Gracefully fail if required commands are not found, fixes issue #8
Browse files Browse the repository at this point in the history
  • Loading branch information
umpirsky committed Nov 9, 2014
1 parent 639e738 commit c00dddc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Umpirsky/PermissionsHandler/ScriptHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@ class ScriptHandler
public static function setPermissions(CommandEvent $event)
{
if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
$event->getIO()->write('No permissions setup is required on Windows.');
$event->getIO()->write('<info>No permissions setup is required on Windows.</info>');
return;
}

$event->getIO()->write('Setting up permissions.');

try {
self::setPermissionsSetfacl($event);

return;
} catch (ProcessFailedException $setfaclException) {
$event->getIO()->write(sprintf('<error>%s</error>', $setfaclException->getMessage()));
$event->getIO()->write('<info>Trying chmod...</info>');
}

try {
self::setPermissionsChmod($event);

return;
} catch (ProcessFailedException $chmodException) {
$event->getIO()->write(sprintf('<error>%s</error>', $chmodException->getMessage()));
}

throw $setfaclException;
}

public static function setPermissionsSetfacl(CommandEvent $event)
Expand Down

0 comments on commit c00dddc

Please sign in to comment.