protected function run_create_course($shortname, $coursesize) {

        // We are in $CFG->dirroot.
        $command = 'php admin/tool/generator/cli/maketestcourse.php';

        $options = array(
            '--shortname="' . $shortname . '"',
            '--size="' . get_string('shortsize_' . $coursesize, 'tool_generator') . '"'
        );

        if (!$this->progress) {
            $options[] = '--quiet';
        }

        if ($this->filesizelimit) {
            $options[] = '--filesizelimit="' . $this->filesizelimit . '"';
        }

        // Extend options.
        $optionstoextend = array(
            'fixeddataset' => 'fixeddataset',
            'bypasscheck' => 'bypasscheck',
        );

        // Getting an options string.
        foreach ($optionstoextend as $attribute => $option) {
            if (!empty($this->{$attribute})) {
                $options[] = '--' . $option;
            }
        }
        $options = implode(' ', $options);
        if ($this->progress) {
            system($command . ' ' . $options, $exitcode);
        } else {
            passthru($command . ' ' . $options, $exitcode);
        }

        if ($exitcode != 0) {
            exit($exitcode);
        }
    }