public function run($input = '', $output = null)
    {
        $this->loadComposerPhar(false);
        if (!$this->application) {
            $this->application = new \Composer\Console\Application();
            $this->application->setAutoExit(false);
        }

        $cli_args = is_string($input) && !empty($input) ?
                new \Symfony\Component\Console\Input\StringInput($input) :
                null;

        $argv0 = $_SERVER['argv'][0];
        $this->fixSelfupdate($cli_args);

        $exitcode = $this->application->run(
            $cli_args,
            $output
        );
        $_SERVER['argv'][0] = $argv0;

        return $exitcode;
    }