Skip to content

Commit

Permalink
fix: Fix edge-cases where 1password cli is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
stmh committed Aug 23, 2022
1 parent 452d4bc commit 35830b4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Utilities/PasswordManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ private function get1PasswordCliFilePath()
{
$op_file_path = getenv('PHAB_OP_FILE_PATH') ?: '/usr/local/bin/op';
if (!$op_file_path || !file_exists($op_file_path)) {
return new CommandResult(1, ['Could not find 1password binary.']);
return false;
}
return $op_file_path;
}
Expand All @@ -275,6 +275,9 @@ private function get1PasswordCliVersion()
static $op_version = false;
if (!$op_version) {
$op_file_path = $this->get1PasswordCliFilePath();
if (!$op_file_path) {
return false;
}
$output = [];
$result_code = 0;
$result = exec(sprintf("%s --version", $op_file_path), $output, $result_code);
Expand All @@ -293,6 +296,9 @@ private function get1PasswordCliVersion()
private function exec1PasswordCli($cmd_v1, $cmd_v2)
{
$op_file_path = $this->get1PasswordCliFilePath();
if (!$op_file_path) {
return new CommandResult(1, ['Could not find 1password binary.']);
}
$output = [];
$result_code = 0;

Expand Down

0 comments on commit 35830b4

Please sign in to comment.