MCPcopy Create free account
hub / github.com/KDE/kdevelop / ScriptAppJob

Method ScriptAppJob

plugins/executescript/scriptappjob.cpp:52–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50} // unnamed namespace
51
52ScriptAppJob::ScriptAppJob(ExecuteScriptPlugin* parent, KDevelop::ILaunchConfiguration* cfg)
53 : OutputJob(parent)
54 , proc(nullptr)
55 , lineMaker(nullptr)
56{
57 qCDebug(PLUGIN_EXECUTESCRIPT) << "creating script app job";
58 setCapabilities(Killable);
59
60 auto* iface = KDevelop::ICore::self()->pluginController()->pluginForExtension(QStringLiteral("org.kdevelop.IExecuteScriptPlugin"))->extension<IExecuteScriptPlugin>();
61 Q_ASSERT(iface);
62
63 QString err;
64 const auto detectError = [&err, this](int errorCode) {
65 if (err.isEmpty()) {
66 return false;
67 }
68 setError(errorCode);
69 setErrorText(err);
70 return true;
71 };
72
73 const auto interpreter = iface->interpreter(cfg, err);
74 if (detectError(-2)) {
75 return;
76 }
77
78 QUrl script;
79 if( !iface->runCurrentFile( cfg ) )
80 {
81 script = iface->script( cfg, err );
82 if (detectError(-3)) {
83 return;
84 }
85 } else {
86 KDevelop::IDocument* document = KDevelop::ICore::self()->documentController()->activeDocument();
87 if( !document )
88 {
89 setError( -1 );
90 setErrorText( i18n( "There is no active document to launch." ) );
91 return;
92 }
93 script = ICore::self()->runtimeController()->currentRuntime()->pathInRuntime(KDevelop::Path(document->url())).toUrl();
94 }
95 const auto scriptPath = script.toLocalFile();
96
97 QString remoteHost = iface->remoteHost( cfg, err );
98 if (detectError(-4)) {
99 return;
100 }
101
102 QStringList arguments = iface->arguments( cfg, err );
103 if (detectError(-5)) {
104 return;
105 }
106
107 auto currentFilterMode = static_cast<KDevelop::OutputModel::OutputFilterStrategy>( iface->outputFilterModeId( cfg ) );
108
109 proc = new KProcess(this);

Callers

nothing calls this directly

Calls 15

modelFunction · 0.85
setProcessEnvironmentFunction · 0.85
pluginControllerMethod · 0.80
interpreterMethod · 0.80
runCurrentFileMethod · 0.80
scriptMethod · 0.80
activeDocumentMethod · 0.80
documentControllerMethod · 0.80
currentRuntimeMethod · 0.80
runtimeControllerMethod · 0.80
toLocalFileMethod · 0.80
remoteHostMethod · 0.80

Tested by

no test coverage detected