forked from qt-creator/qt-creator
RemoteLinux: Don't rely on the presence of pkill.
Change-Id: Iad42c1c356d9c3914e46082decc0a38d844ed98d Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -212,24 +212,6 @@ void MaemoSshRunner::unmount()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoSshRunner::killApplicationCommandLine() const
|
|
||||||
{
|
|
||||||
// Prevent pkill from matching our own pkill call.
|
|
||||||
QString pkillArg = remoteExecutable();
|
|
||||||
const int lastPos = pkillArg.count() - 1;
|
|
||||||
pkillArg.replace(lastPos, 1, QLatin1Char('[') + pkillArg.at(lastPos) + QLatin1Char(']'));
|
|
||||||
|
|
||||||
// Fremantle's busybox configuration is strange.
|
|
||||||
const char *killTemplate;
|
|
||||||
if (devConfig()->osType() == QLatin1String(Maemo5OsType))
|
|
||||||
killTemplate = "pkill -f -%2 %1";
|
|
||||||
else
|
|
||||||
killTemplate = "pkill -%2 -f %1";
|
|
||||||
const QString niceKill = QString::fromLocal8Bit(killTemplate).arg(pkillArg).arg("SIGTERM");
|
|
||||||
const QString brutalKill = QString::fromLocal8Bit(killTemplate).arg(pkillArg).arg("SIGKILL");
|
|
||||||
return niceKill + QLatin1String("; sleep 1; ") + brutalKill;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Madde
|
} // namespace Madde
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ private:
|
|||||||
void doAdditionalInitializations();
|
void doAdditionalInitializations();
|
||||||
void doPostRunCleanup();
|
void doPostRunCleanup();
|
||||||
void doAdditionalConnectionErrorHandling();
|
void doAdditionalConnectionErrorHandling();
|
||||||
QString killApplicationCommandLine() const;
|
|
||||||
|
|
||||||
void mount();
|
void mount();
|
||||||
void unmount();
|
void unmount();
|
||||||
|
|||||||
@@ -450,6 +450,17 @@ void AbstractRemoteLinuxApplicationRunner::handlePostRunCleanupDone()
|
|||||||
emit error(tr("Error running remote process: %1").arg(d->runner->errorString()));
|
emit error(tr("Error running remote process: %1").arg(d->runner->errorString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AbstractRemoteLinuxApplicationRunner::killApplicationCommandLine() const
|
||||||
|
{
|
||||||
|
return QString::fromLocal8Bit("cd /proc; for pid in `ls -d [0123456789]*`; "
|
||||||
|
"do "
|
||||||
|
"if [ \"`readlink /proc/$pid/exe`\" = \"%1\" ]; then "
|
||||||
|
" kill $pid; sleep 1; kill -9 $pid; "
|
||||||
|
"fi; "
|
||||||
|
"done").arg(remoteExecutable());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const qint64 AbstractRemoteLinuxApplicationRunner::InvalidExitCode = std::numeric_limits<qint64>::min();
|
const qint64 AbstractRemoteLinuxApplicationRunner::InvalidExitCode = std::numeric_limits<qint64>::min();
|
||||||
|
|
||||||
|
|
||||||
@@ -488,18 +499,5 @@ void GenericRemoteLinuxApplicationRunner::doAdditionalConnectionErrorHandling()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GenericRemoteLinuxApplicationRunner::killApplicationCommandLine() const
|
|
||||||
{
|
|
||||||
// Prevent pkill from matching our own pkill call.
|
|
||||||
QString pkillArg = remoteExecutable();
|
|
||||||
const int lastPos = pkillArg.count() - 1;
|
|
||||||
pkillArg.replace(lastPos, 1, QLatin1Char('[') + pkillArg.at(lastPos) + QLatin1Char(']'));
|
|
||||||
|
|
||||||
const char * const killTemplate = "pkill -%2 -f %1";
|
|
||||||
const QString niceKill = QString::fromLocal8Bit(killTemplate).arg(pkillArg).arg("SIGTERM");
|
|
||||||
const QString brutalKill = QString::fromLocal8Bit(killTemplate).arg(pkillArg).arg("SIGKILL");
|
|
||||||
return niceKill + QLatin1String("; sleep 1; ") + brutalKill;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
virtual QString killApplicationCommandLine() const = 0;
|
virtual QString killApplicationCommandLine() const;
|
||||||
|
|
||||||
// Implement to do custom setup of the device *before* connecting.
|
// Implement to do custom setup of the device *before* connecting.
|
||||||
// Call handleDeviceSetupDone() afterwards.
|
// Call handleDeviceSetupDone() afterwards.
|
||||||
@@ -145,9 +145,6 @@ protected:
|
|||||||
void doAdditionalInitializations();
|
void doAdditionalInitializations();
|
||||||
void doPostRunCleanup();
|
void doPostRunCleanup();
|
||||||
void doAdditionalConnectionErrorHandling();
|
void doAdditionalConnectionErrorHandling();
|
||||||
|
|
||||||
private:
|
|
||||||
QString killApplicationCommandLine() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
||||||
|
|||||||
Reference in New Issue
Block a user