|
Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
|
Running the application: sonde start, stop, status and log (design 0028). More...
#include "run.h"#include "common.h"#include "endpoints.h"#include "processes.h"#include <QtCore/QDeadlineTimer>#include <QtCore/QDir>#include <QtCore/QElapsedTimer>#include <QtCore/QFile>#include <QtCore/QFileInfo>#include <QtCore/QJsonArray>#include <QtCore/QJsonDocument>#include <QtCore/QProcess>#include <QtCore/QStandardPaths>#include <QtCore/QThread>#include <QtNetwork/QLocalSocket>#include <array>#include <optional>Namespaces | |
| namespace | Sonde |
| Embeddable Model Context Protocol server for Qt applications. | |
Functions | |
| QString | Sonde::Cli::anonymous_namespace{run.cpp}::pidFile (const Project &project) |
| .sonde/state/pid: the pid sonde started, and when that process started. | |
| QString | Sonde::Cli::anonymous_namespace{run.cpp}::appLog (const Project &project) |
| .sonde/state/app.log: the application's output. | |
| QString | Sonde::Cli::anonymous_namespace{run.cpp}::buildLog (const Project &project) |
| .sonde/state/build.log: the build's output. | |
| QString | Sonde::Cli::anonymous_namespace{run.cpp}::relativePath (const QString &path) |
path relative to the working directory, as Python's os.path.relpath() gives it. | |
| QString | Sonde::Cli::anonymous_namespace{run.cpp}::programFor (const QString &name, const QString &root, const QProcessEnvironment &env) |
The program name names, for a process started in root with env: as Python's subprocess finds it, a path relative to root, or else from the PATH in env. | |
| qint64 | Sonde::Cli::anonymous_namespace{run.cpp}::exitStatusOf (const QProcess &process) |
| A finished process's exit status as Python reports it: its exit code, or minus the signal that ended it (POSIX). | |
| void | Sonde::Cli::anonymous_namespace{run.cpp}::writePid (const Project &project, qint64 pid) |
Records pid, with when it started, as the one sonde started. | |
| std::optional< qint64 > | Sonde::Cli::anonymous_namespace{run.cpp}::readPid (const Project &project) |
| The pid sonde started, if that process is still the one running under it. | |
| bool | Sonde::Cli::anonymous_namespace{run.cpp}::localSocketReady (const QString &name) |
Whether something accepts connections on local socket name. | |
| QStringList | Sonde::Cli::anonymous_namespace{run.cpp}::alreadyAnswering (const Endpoints &ends) |
The endpoints of ends that answer although the copy sonde started is stopped: another process holds them. | |
| QString | Sonde::Cli::anonymous_namespace{run.cpp}::whoHolds (const Endpoints &ends) |
Which application holds the endpoints of ends, if it is a Sonde application that answers; otherwise an empty string. | |
| QStringList | Sonde::Cli::anonymous_namespace{run.cpp}::listenErrors (const Project &project) |
| Sonde's warnings about listeners that failed to start, from the application's output. | |
| void | Sonde::Cli::anonymous_namespace{run.cpp}::build (const QJsonObject &config, const Project &project) |
| Runs the build in "build", if there is one; exits with 2 if it fails. | |
| QProcessEnvironment | Sonde::Cli::anonymous_namespace{run.cpp}::applicationEnvironment (const QJsonObject &config) |
The environment the application gets: sonde's, with "env" and the endpoints of config. | |
| QProcess * | Sonde::Cli::anonymous_namespace{run.cpp}::startApplication (const QJsonObject &config, const Project &project, const QString &log) |
Starts the application with its output in log; exits with 1 if it can't. | |
| double | Sonde::Cli::anonymous_namespace{run.cpp}::readyTimeout (const QJsonObject &config) |
| "readyTimeout": how long to wait for the application to listen, in seconds. | |
| QString | Sonde::Cli::tail (const QString &path, int lines) |
The last lines lines of the file at path, as the Python sonde's tail() gave them: Python's readlines()[-lines:], so 0 gives every line. | |
| QStringList | Sonde::Cli::runCommand (const QJsonObject &config, const QString &root) |
| The command that starts the application: "run", with a bundle replaced by its binary and, on Windows, .exe added where "run" leaves it out. | |
| void | Sonde::Cli::start (const QJsonObject &config, const Project &project, bool build) |
sonde start: builds (if build), stops any copy started earlier, starts the application and waits until Sonde listens. | |
| void | Sonde::Cli::stop (const Project &project, bool quiet=false) |
sonde stop: stops the copy sonde started, saying so unless quiet. | |
| void | Sonde::Cli::status (const QJsonObject &config, const Project &project) |
| sonde status: whether the copy sonde started is running, its pid and endpoints. | |
| void | Sonde::Cli::showLog (const Project &project, int lines) |
sonde log: the last lines lines of the application's output. | |
Running the application: sonde start, stop, status and log (design 0028).
| void Sonde::Cli::start | ( | const QJsonObject & | config, |
| const Project & | project, | ||
| bool | build ) |
sonde start: builds (if build), stops any copy started earlier, starts the application and waits until Sonde listens.
Exits with 1 if it doesn't, 2 if the build fails.
| QString Sonde::Cli::tail | ( | const QString & | path, |
| int | lines ) |
The last lines lines of the file at path, as the Python sonde's tail() gave them: Python's readlines()[-lines:], so 0 gives every line.
Empty if the file can't be read.