diff --git a/config/credentials.php b/config/credentials.php index 368ac5b..9213ebb 100644 --- a/config/credentials.php +++ b/config/credentials.php @@ -15,6 +15,10 @@ 'cipher' => config('app.cipher'), - 'editor' => env('EDITOR', 'vi') + 'editor' => env('EDITOR', 'vi'), + + 'editorParams' => env('EDITOR_PARAMS'), + + 'timeout' => env('EDITOR_TIMEOUT', 60) ]; diff --git a/src/EditCredentialsCommand.php b/src/EditCredentialsCommand.php index efb7aad..6b92cbd 100644 --- a/src/EditCredentialsCommand.php +++ b/src/EditCredentialsCommand.php @@ -39,11 +39,19 @@ public function handle(Credentials $credentials) fwrite($handle, json_encode($decrypted, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT)); - $editor = config('credential.editor', 'vi'); + $editor = config('credentials.editor', 'vi'); + $editorParams = config('credentials.editorParams'); - $process = new Process([$editor, $meta['uri']]); + $process = new Process([$editor, $editorParams, $meta['uri']], + null, + null, + null, + config('credentials.timeout')); - $process->setTty(true); + if (!(stripos(PHP_OS, 'WIN') === 0 || PHP_OS_FAMILY === "Windows")) + { + $process->setTty(true); + } $process->mustRun(); $data = json_decode(file_get_contents($meta['uri']), JSON_OBJECT_AS_ARRAY);