38 #include <QCoreApplication> 46 #if CONFIG_CYGWIN || defined(_WIN32) 59 #if CONFIG_CYGWIN || defined(_WIN32) 69 setObjectName(
"MythSystemLegacy()");
78 setObjectName(QString(
"MythSystemLegacy(%1)").arg(command));
99 LOG(VB_GENERAL, LOG_ERR,
100 QString(
"MythSystemLegacy(%1) command not understood")
119 const QStringList &
args,
133 const QStringList &
args,
uint flags)
159 if (!
GetSetting(
"UseShell") && (access(command.toUtf8().constData(), X_OK)) != 0)
161 LOG(VB_GENERAL, LOG_ERR,
162 QString(
"MythSystemLegacy(%1) command not executable, ")
163 .arg(command) +
ENO);
264 qApp->processEvents();
302 int posix_signal = SIGTRAP;
323 if (SIGTRAP == posix_signal)
325 LOG(VB_SYSTEM, LOG_ERR,
326 QString(
"Programmer error: Unknown signal %1").arg(sig));
338 LOG(VB_SYSTEM, LOG_DEBUG, QString(
"status: %1").arg(
m_status));
350 LOG(VB_SYSTEM, LOG_DEBUG,
"Adding background flag");
416 return m_stdbuff[0].write(ba.constData());
481 if (out.contains(
"\""))
482 out = out.replace(
"\"",
"\\\"");
484 if (out.contains(
"\'"))
485 out = out.replace(
"\'",
"\\\'");
487 if (out.contains(
" "))
506 uint result = ms->Wait(0);
507 if (!ms->GetSetting(
"RunInBackground"))
516 QString cmd(command);
unsigned int myth_system_c(char *command, uint flags, uint timeout)
virtual void Term(bool force=false)=0
void Run(time_t timeout=0)
Runs a command inside the /bin/sh shell. Returns immediately.
virtual void Manage(void)=0
General purpose reference counter.
MythSystemLegacyPrivate * d
static QString ShellEscape(const QString &in)
QByteArray Read(int size)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
void SetCommand(const QString &, uint)
Resets an existing MythSystemLegacy object to a new command.
MythSystemLegacyPrivate(const QString &debugName)
static Type kPushDisableDrawingEventType
void initializePrivate(void)
static Type kPopDisableDrawingEventType
void ProcessFlags(uint flags)
add arguments for MythTV log propagation
void Term(bool force=false)
virtual bool ParseShell(const QString &cmd, QString &abscmd, QStringList &args)=0
static Type kLockInputDevicesEventType
#define GENERIC_EXIT_CMD_NOT_FOUND
Command not found.
bool logPropagateQuiet(void)
Check if we are propagating a "--quiet".
void SetDirectory(const QString &)
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
#define GENERIC_EXIT_NO_HANDLER
No MythSystemLegacy Handler.
#define GENERIC_EXIT_RUNNING
Process is running.
uint myth_system(const QString &command, uint flags, uint timeout)
#define ENO
This can be appended to the LOG args with "+".
virtual void Fork(time_t timeout)=0
disable MythMessage UDP listener for the duration of application.
uint Wait(time_t timeout=0)
#define GENERIC_EXIT_START
MythSystemLegacy process starting.
static Type kEnableUDPListenerEventType
run process through shell
static Type kDisableUDPListenerEventType
automatically delete if backgrounded
process events while waiting
#define LOG(_MASK_, _LEVEL_, _STRING_)
QByteArray ReadErr(int size)
avoid disabling UI drawing
int Write(const QByteArray &)
This writes to the standard input of the program being run.
virtual void Signal(int sig)=0
run child in the background
QByteArray & ReadAllErr()
MythSystemLegacy(QObject *=nullptr)
bool GetSetting(const char *setting)
#define GENERIC_EXIT_INVALID_CMDLINE
Command line parse error.
QObject * GetGUIObject(void)
static Type kUnlockInputDevicesEventType
avoid blocking LIRC & Joystick Menu
allow exit values 0-127 only
QStringList logPropagateArgList