Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistCallConduitWorkflow.php
| Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | EOTEXT | ||||
| public function requiresAuthentication() { | public function requiresAuthentication() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| public function run() { | public function run() { | ||||
| $method = $this->getArgument('method', array()); | $method = $this->getArgument('method', array()); | ||||
| if (count($method) !== 1) { | if (count($method) !== 1) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| "Provide exactly one Conduit method name."); | 'Provide exactly one Conduit method name.'); | ||||
| } | } | ||||
| $method = reset($method); | $method = reset($method); | ||||
| $console = PhutilConsole::getConsole(); | $console = PhutilConsole::getConsole(); | ||||
| $console->writeErr("%s\n", pht('Waiting for JSON parameters on stdin...')); | $console->writeErr("%s\n", pht('Waiting for JSON parameters on stdin...')); | ||||
| $params = @file_get_contents('php://stdin'); | $params = @file_get_contents('php://stdin'); | ||||
| $params = json_decode($params, true); | $params = json_decode($params, true); | ||||
| if (!is_array($params)) { | if (!is_array($params)) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| "Provide method parameters on stdin as a JSON blob."); | 'Provide method parameters on stdin as a JSON blob.'); | ||||
| } | } | ||||
| $error = null; | $error = null; | ||||
| $error_message = null; | $error_message = null; | ||||
| try { | try { | ||||
| $result = $this->getConduit()->callMethodSynchronous( | $result = $this->getConduit()->callMethodSynchronous( | ||||
| $method, | $method, | ||||
| $params); | $params); | ||||
| Show All 15 Lines | |||||