Skip to content

Commit

Permalink
Merge pull request #122 from tienvx/fix-cant-reduce-path
Browse files Browse the repository at this point in the history
Fix can't reduce path
  • Loading branch information
tienvx committed Dec 25, 2018
2 parents 8d4579a + c8501eb commit c353944
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Command/CommandRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ public function run(array $parameters)
$process->setTimeout(null);
$process->setWorkingDirectory($this->kernel->getProjectDir());

$process->run();
$exitCode = $process->run();

if ($error = $process->getErrorOutput()) {
if ($exitCode) {
$error = $process->getErrorOutput();
$this->logger->error($error);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Command/ReducePathCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$bugId = $input->getArgument('bug-id');
$reducer = $input->getArgument('reducer');
$data = json_decode($input->getArgument('data'), true);
$data = $input->getArgument('data');
$data = json_decode(trim($data, "'"), true);
$message = new ReductionMessage($bugId, $reducer, $data);

$this->setAnonymousToken();
Expand Down
2 changes: 1 addition & 1 deletion src/MessageHandler/ReductionMessageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public function __invoke(ReductionMessage $message)
$bugId = $message->getBugId();
$reducer = $message->getReducer();
$data = $message->getData();
$this->commandRunner->run(['mbt:path:reduce', $bugId, $reducer, "'" . json_encode($data) . "'"]);
$this->commandRunner->run(['mbt:path:reduce', $bugId, $reducer, json_encode($data)]);
}
}
3 changes: 3 additions & 0 deletions tests/app/src/Command/CommandRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public function run(array $parameters)
{
$application = new Application($this->kernel);
$application->setAutoExit(false);
if ($parameters[0] === 'mbt:path:reduce') {
$parameters[3] = "'{$parameters[3]}'";
}
$application->run(new StringInput(implode(' ', $parameters)), new NullOutput());
}
}

0 comments on commit c353944

Please sign in to comment.