static QScriptValue js_Command(QScriptContext *context, QScriptEngine *engine) { if (Q_UNLIKELY(!context->isCalledAsConstructor())) return context->throwError(Tr::tr("Command constructor called without new.")); static ProcessCommandPtr commandPrototype = ProcessCommand::create(); QScriptValue program = context->argument(0); if (program.isUndefined()) program = engine->toScriptValue(commandPrototype->program()); QScriptValue arguments = context->argument(1); if (arguments.isUndefined()) arguments = engine->toScriptValue(commandPrototype->arguments()); QScriptValue cmd = js_CommandBase(context, engine); cmd.setProperty(StringConstants::classNameProperty(), engine->toScriptValue(StringConstants::commandType())); cmd.setProperty(programProperty(), program); cmd.setProperty(argumentsProperty(), arguments); cmd.setProperty(workingDirProperty(), engine->toScriptValue(commandPrototype->workingDir())); cmd.setProperty(maxExitCodeProperty(), engine->toScriptValue(commandPrototype->maxExitCode())); cmd.setProperty(stdoutFilterFunctionProperty(), engine->toScriptValue(commandPrototype->stdoutFilterFunction())); cmd.setProperty(stderrFilterFunctionProperty(), engine->toScriptValue(commandPrototype->stderrFilterFunction())); cmd.setProperty(responseFileThresholdProperty(), engine->toScriptValue(commandPrototype->responseFileThreshold())); cmd.setProperty(responseFileArgumentIndexProperty(), engine->toScriptValue(commandPrototype->responseFileArgumentIndex())); cmd.setProperty(responseFileUsagePrefixProperty(), engine->toScriptValue(commandPrototype->responseFileUsagePrefix())); cmd.setProperty(stdoutFilePathProperty(), engine->toScriptValue(commandPrototype->stdoutFilePath())); cmd.setProperty(stderrFilePathProperty(), engine->toScriptValue(commandPrototype->stderrFilePath())); cmd.setProperty(environmentProperty(), engine->toScriptValue(commandPrototype->environment().toStringList())); cmd.setProperty(ignoreDryRunProperty(), engine->toScriptValue(commandPrototype->ignoreDryRun())); return cmd; }
static QScriptValue js_Command(QScriptContext *context, QScriptEngine *engine) { if (Q_UNLIKELY(!context->isCalledAsConstructor())) return context->throwError(Tr::tr("Command constructor called without new.")); static ProcessCommandPtr commandPrototype = ProcessCommand::create(); QScriptValue program = context->argument(0); if (program.isUndefined()) program = engine->toScriptValue(commandPrototype->program()); QScriptValue arguments = context->argument(1); if (arguments.isUndefined()) arguments = engine->toScriptValue(commandPrototype->arguments()); QScriptValue cmd = js_CommandBase(context, engine); cmd.setProperty(QLatin1String("className"), engine->toScriptValue(QString::fromLatin1("Command"))); cmd.setProperty(QLatin1String("program"), program); cmd.setProperty(QLatin1String("arguments"), arguments); cmd.setProperty(QLatin1String("workingDir"), engine->toScriptValue(commandPrototype->workingDir())); cmd.setProperty(QLatin1String("maxExitCode"), engine->toScriptValue(commandPrototype->maxExitCode())); cmd.setProperty(QLatin1String("stdoutFilterFunction"), engine->toScriptValue(commandPrototype->stdoutFilterFunction())); cmd.setProperty(QLatin1String("stderrFilterFunction"), engine->toScriptValue(commandPrototype->stderrFilterFunction())); cmd.setProperty(QLatin1String("responseFileThreshold"), engine->toScriptValue(commandPrototype->responseFileThreshold())); cmd.setProperty(QLatin1String("responseFileArgumentIndex"), engine->toScriptValue(commandPrototype->responseFileArgumentIndex())); cmd.setProperty(QLatin1String("responseFileUsagePrefix"), engine->toScriptValue(commandPrototype->responseFileUsagePrefix())); cmd.setProperty(QLatin1String("stdoutFilePath"), engine->toScriptValue(commandPrototype->stdoutFilePath())); cmd.setProperty(QLatin1String("stderrFilePath"), engine->toScriptValue(commandPrototype->stderrFilePath())); cmd.setProperty(QLatin1String("environment"), engine->toScriptValue(commandPrototype->environment().toStringList())); cmd.setProperty(QLatin1String("ignoreDryRun"), engine->toScriptValue(commandPrototype->ignoreDryRun())); return cmd; }