mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-06-07 07:32:34 +02:00
2019-01-09 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdpadengined(8) that caused PyPAD script errors to fail to be logged.
This commit is contained in:
parent
b92943f3e8
commit
a753f39541
@ -18337,3 +18337,6 @@
|
|||||||
2019-01-09 Fred Gleason <fredg@paravelsystems.com>
|
2019-01-09 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Fixed a bug in rddbmgr(8) that caused DB corruption in multi-byte
|
* Fixed a bug in rddbmgr(8) that caused DB corruption in multi-byte
|
||||||
UTF-8 strings when reverting the schema.
|
UTF-8 strings when reverting the schema.
|
||||||
|
2019-01-09 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Fixed a bug in rdpadengined(8) that caused PyPAD script errors
|
||||||
|
to fail to be logged.
|
||||||
|
@ -31,6 +31,8 @@ RDProcess::RDProcess(int id,QObject *parent)
|
|||||||
connect(p_process,SIGNAL(started()),this,SLOT(startedData()));
|
connect(p_process,SIGNAL(started()),this,SLOT(startedData()));
|
||||||
connect(p_process,SIGNAL(finished(int,QProcess::ExitStatus)),
|
connect(p_process,SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||||
this,SLOT(finishedData(int,QProcess::ExitStatus)));
|
this,SLOT(finishedData(int,QProcess::ExitStatus)));
|
||||||
|
connect(p_process,SIGNAL(readyReadStandardError()),
|
||||||
|
this,SLOT(readyReadStandardErrorData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -103,6 +105,12 @@ void RDProcess::finishedData(int exit_code,QProcess::ExitStatus status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RDProcess::readyReadStandardErrorData()
|
||||||
|
{
|
||||||
|
p_standard_error_data+=process()->readAllStandardError();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void *RDProcess::privateData() const
|
void *RDProcess::privateData() const
|
||||||
{
|
{
|
||||||
return p_private_data;
|
return p_private_data;
|
||||||
@ -113,3 +121,9 @@ void RDProcess::setPrivateData(void *priv)
|
|||||||
{
|
{
|
||||||
p_private_data=priv;
|
p_private_data=priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QByteArray RDProcess::standardErrorData() const
|
||||||
|
{
|
||||||
|
return p_standard_error_data;
|
||||||
|
}
|
||||||
|
@ -37,6 +37,7 @@ class RDProcess : public QObject
|
|||||||
QString errorText() const;
|
QString errorText() const;
|
||||||
void *privateData() const;
|
void *privateData() const;
|
||||||
void setPrivateData(void *priv);
|
void setPrivateData(void *priv);
|
||||||
|
QByteArray standardErrorData() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void started(int id);
|
void started(int id);
|
||||||
@ -45,6 +46,7 @@ class RDProcess : public QObject
|
|||||||
private slots:
|
private slots:
|
||||||
void startedData();
|
void startedData();
|
||||||
void finishedData(int exit_code,QProcess::ExitStatus status);
|
void finishedData(int exit_code,QProcess::ExitStatus status);
|
||||||
|
void readyReadStandardErrorData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int p_id;
|
int p_id;
|
||||||
@ -53,6 +55,7 @@ class RDProcess : public QObject
|
|||||||
QProcess *p_process;
|
QProcess *p_process;
|
||||||
QString p_error_text;
|
QString p_error_text;
|
||||||
void *p_private_data;
|
void *p_private_data;
|
||||||
|
QByteArray p_standard_error_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,13 +64,17 @@ MainObject::MainObject(QObject *parent)
|
|||||||
//
|
//
|
||||||
if(getuid()==0) {
|
if(getuid()==0) {
|
||||||
if(setgid(rda->config()->pypadGid())!=0) {
|
if(setgid(rda->config()->pypadGid())!=0) {
|
||||||
fprintf(stderr,"rdpadengined: unable to set GID to %d [%s]\n",
|
rda->log(RDConfig::LogErr,
|
||||||
rda->config()->pypadGid(),strerror(errno));
|
QString().sprintf("unable to set GID to %d [",
|
||||||
|
rda->config()->pypadGid())+
|
||||||
|
QString(strerror(errno))+"], exiting");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if(setuid(rda->config()->pypadUid())!=0) {
|
if(setuid(rda->config()->pypadUid())!=0) {
|
||||||
fprintf(stderr,"rdpadengined: unable to set UID to %d [%s]\n",
|
rda->log(RDConfig::LogErr,
|
||||||
rda->config()->pypadUid(),strerror(errno));
|
QString().sprintf("unable to set UID to %d [",
|
||||||
|
rda->config()->pypadUid())+
|
||||||
|
QString(strerror(errno))+"], exiting");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,8 +84,9 @@ MainObject::MainObject(QObject *parent)
|
|||||||
//
|
//
|
||||||
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
|
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
|
||||||
if(!rda->cmdSwitch()->processed(i)) {
|
if(!rda->cmdSwitch()->processed(i)) {
|
||||||
fprintf(stderr,"rdpadengined: unknown command option \"%s\"\n",
|
rda->log(RDConfig::LogErr,
|
||||||
(const char *)rda->cmdSwitch()->key(i));
|
QString("unknown command option \"")+rda->cmdSwitch()->key(i)+
|
||||||
|
"\"");
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,8 +192,9 @@ void MainObject::instanceFinishedData(int id)
|
|||||||
RDProcess *proc=pad_instances.value(id);
|
RDProcess *proc=pad_instances.value(id);
|
||||||
|
|
||||||
if(proc->process()->exitStatus()!=QProcess::NormalExit) {
|
if(proc->process()->exitStatus()!=QProcess::NormalExit) {
|
||||||
fprintf(stderr,"rdpadengined: process %d crashed\n",id);
|
rda->log(RDConfig::LogWarning,
|
||||||
SetRunStatus(id,false,-1,proc->process()->readAllStandardError());
|
QString().sprintf("PyPAD script %d crashed\n",id));
|
||||||
|
SetRunStatus(id,false,-1,proc->standardErrorData());
|
||||||
proc->deleteLater();
|
proc->deleteLater();
|
||||||
pad_instances.remove(id);
|
pad_instances.remove(id);
|
||||||
return;
|
return;
|
||||||
@ -205,8 +211,11 @@ void MainObject::instanceFinishedData(int id)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(!global_pad_exiting) {
|
if(!global_pad_exiting) {
|
||||||
|
rda->log(RDConfig::LogWarning,
|
||||||
|
QString().sprintf("PyPAD script ID %d exited with code %d",
|
||||||
|
id,proc->process()->exitCode()));
|
||||||
SetRunStatus(id,false,proc->process()->exitCode(),
|
SetRunStatus(id,false,proc->process()->exitCode(),
|
||||||
proc->process()->readAllStandardError());
|
proc->standardErrorData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,13 +252,14 @@ void MainObject::StartScript(unsigned id,const QString &script_path)
|
|||||||
connect(proc,SIGNAL(started(int)),this,SLOT(instanceStartedData(int)));
|
connect(proc,SIGNAL(started(int)),this,SLOT(instanceStartedData(int)));
|
||||||
connect(proc,SIGNAL(finished(int)),this,SLOT(instanceFinishedData(int)));
|
connect(proc,SIGNAL(finished(int)),this,SLOT(instanceFinishedData(int)));
|
||||||
QStringList args;
|
QStringList args;
|
||||||
|
args.push_back("-u");
|
||||||
args.push_back(script_path);
|
args.push_back(script_path);
|
||||||
args.push_back("localhost");
|
args.push_back("localhost");
|
||||||
args.push_back(QString().sprintf("%u",RD_PAD_CLIENT_TCP_PORT));
|
args.push_back(QString().sprintf("%u",RD_PAD_CLIENT_TCP_PORT));
|
||||||
args.push_back(QString().sprintf("$%u",id));
|
args.push_back(QString().sprintf("$%u",id));
|
||||||
pad_instances.value(id)->start(RD_PYPAD_PYTHON_PATH,args);
|
pad_instances.value(id)->start(RD_PYPAD_PYTHON_PATH,args);
|
||||||
syslog(LOG_NOTICE,"starting: %s %s",(const char *)proc->program().toUtf8(),
|
rda->log(RDConfig::LogInfo,"starting: "+proc->program()+" "+
|
||||||
(const char *)proc->arguments().join(" ").toUtf8());
|
proc->arguments().join(" ").toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user