Ejemplo n.º 1
0
void ProcessCommand::fillFromScriptValue(const QScriptValue *scriptValue, const CodeLocation &codeLocation)
{
    AbstractCommand::fillFromScriptValue(scriptValue, codeLocation);
    m_program = scriptValue->property(programProperty()).toString();
    m_arguments = scriptValue->property(argumentsProperty()).toVariant().toStringList();
    m_workingDir = scriptValue->property(workingDirProperty()).toString();
    m_maxExitCode = scriptValue->property(maxExitCodeProperty()).toInt32();

    // toString() is required, presumably due to QtScript bug that manifests itself on Windows
    const QScriptValue stdoutFilterFunction
            = scriptValue->property(stdoutFilterFunctionProperty()).toString();

    m_stdoutFilterFunction = invokedSourceCode(stdoutFilterFunction);

    // toString() is required, presumably due to QtScript bug that manifests itself on Windows
    const QScriptValue stderrFilterFunction
            = scriptValue->property(stderrFilterFunctionProperty()).toString();

    m_stderrFilterFunction = invokedSourceCode(stderrFilterFunction);
    m_relevantEnvVars = scriptValue->property(QStringLiteral("relevantEnvironmentVariables"))
            .toVariant().toStringList();
    m_responseFileThreshold = scriptValue->property(responseFileThresholdProperty())
            .toInt32();
    m_responseFileArgumentIndex = scriptValue->property(responseFileArgumentIndexProperty())
            .toInt32();
    m_responseFileUsagePrefix = scriptValue->property(responseFileUsagePrefixProperty())
            .toString();
    QStringList envList = scriptValue->property(environmentProperty()).toVariant()
            .toStringList();
    getEnvironmentFromList(envList);
    m_stdoutFilePath = scriptValue->property(stdoutFilePathProperty()).toString();
    m_stderrFilePath = scriptValue->property(stderrFilePathProperty()).toString();

    m_predefinedProperties
            << programProperty()
            << argumentsProperty()
            << workingDirProperty()
            << maxExitCodeProperty()
            << stdoutFilterFunctionProperty()
            << stderrFilterFunctionProperty()
            << responseFileThresholdProperty()
            << responseFileArgumentIndexProperty()
            << responseFileUsagePrefixProperty()
            << environmentProperty()
            << stdoutFilePathProperty()
            << stderrFilePathProperty();
    applyCommandProperties(scriptValue);
}
Ejemplo n.º 2
0
void ProcessCommand::fillFromScriptValue(const QScriptValue *scriptValue, const CodeLocation &codeLocation)
{
    AbstractCommand::fillFromScriptValue(scriptValue, codeLocation);
    m_program = scriptValue->property(QLatin1String("program")).toString();
    m_arguments = scriptValue->property(QLatin1String("arguments")).toVariant().toStringList();
    m_workingDir = scriptValue->property(QLatin1String("workingDirectory")).toString();
    m_maxExitCode = scriptValue->property(QLatin1String("maxExitCode")).toInt32();
    QScriptValue stdoutFilterFunction =
            scriptValue->property(QLatin1String("stdoutFilterFunction")).toString();
    if (stdoutFilterFunction.isFunction())
        m_stdoutFilterFunction = QLatin1String("(") + stdoutFilterFunction.toString()
                + QLatin1String(")()");
    else
        m_stdoutFilterFunction = stdoutFilterFunction.toString();
    QScriptValue stderrFilterFunction =
            scriptValue->property(QLatin1String("stderrFilterFunction")).toString();
    if (stderrFilterFunction.isFunction())
        m_stderrFilterFunction = QLatin1String("(") + stderrFilterFunction.toString()
                + QLatin1String(")()");
    else
        m_stderrFilterFunction = stderrFilterFunction.toString();
    m_responseFileThreshold = scriptValue->property(QLatin1String("responseFileThreshold"))
            .toInt32();
    m_responseFileArgumentIndex = scriptValue->property(QLatin1String("responseFileArgumentIndex"))
            .toInt32();
    m_responseFileUsagePrefix = scriptValue->property(QLatin1String("responseFileUsagePrefix"))
            .toString();
    QStringList envList = scriptValue->property(QLatin1String("environment")).toVariant()
            .toStringList();
    getEnvironmentFromList(envList);
    m_stdoutFilePath = scriptValue->property(QLatin1String("stdoutFilePath")).toString();
    m_stderrFilePath = scriptValue->property(QLatin1String("stderrFilePath")).toString();

    m_predefinedProperties
            << QLatin1String("program")
            << QLatin1String("arguments")
            << QLatin1String("workingDirectory")
            << QLatin1String("maxExitCode")
            << QLatin1String("stdoutFilterFunction")
            << QLatin1String("stderrFilterFunction")
            << QLatin1String("responseFileThreshold")
            << QLatin1String("responseFileArgumentIndex")
            << QLatin1String("responseFileUsagePrefix")
            << QLatin1String("environment")
            << QLatin1String("stdoutFilePath")
            << QLatin1String("stderrFilePath");
    applyCommandProperties(scriptValue);
}