| 35 | { |
| 36 | |
| 37 | Job::Job(KDevelop::ILaunchConfiguration* launchConfig, IExecutePlugin* executePlugin) |
| 38 | { |
| 39 | setCapabilities(Killable); |
| 40 | |
| 41 | Q_ASSERT(launchConfig); |
| 42 | Q_ASSERT(executePlugin); |
| 43 | |
| 44 | QString errorString; |
| 45 | const auto detectError = [&errorString, this](int errorCode) { |
| 46 | if (errorString.isEmpty()) { |
| 47 | return false; |
| 48 | } |
| 49 | setError(errorCode); |
| 50 | setErrorText(errorString); |
| 51 | return true; |
| 52 | }; |
| 53 | |
| 54 | const auto analyzedExecutable = executePlugin->executable(launchConfig, errorString).toLocalFile(); |
| 55 | if (detectError(-1)) { |
| 56 | return; |
| 57 | } |
| 58 | QStringList analyzedExecutableArguments = executePlugin->arguments(launchConfig, errorString); |
| 59 | if (detectError(-2)) { |
| 60 | return; |
| 61 | } |
| 62 | |
| 63 | setEnvironmentProfile(validEnvironmentProfileName(executePlugin->environmentProfileName(launchConfig))); |
| 64 | |
| 65 | const QFileInfo analyzedExecutableInfo(analyzedExecutable); |
| 66 | |
| 67 | QUrl workDir = executePlugin->workingDirectory(launchConfig); |
| 68 | if (workDir.isEmpty() || !workDir.isValid()) { |
| 69 | workDir = QUrl::fromLocalFile(analyzedExecutableInfo.absolutePath()); |
| 70 | } |
| 71 | setWorkingDirectory(workDir); |
| 72 | |
| 73 | *this << KDevelop::Path(GlobalSettings::heaptrackExecutable()).toLocalFile(); |
| 74 | *this << analyzedExecutable; |
| 75 | *this << analyzedExecutableArguments; |
| 76 | |
| 77 | setup(analyzedExecutableInfo.fileName()); |
| 78 | } |
| 79 | |
| 80 | Job::Job(long int pid) |
| 81 | { |
nothing calls this directly
no test coverage detected