diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-08-10 08:11:47 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-08-17 10:19:41 +1000 |
commit | 60e6db663a21e3cb30ece7da7ccfbf419a200369 (patch) | |
tree | c68e2edea692d8e3126fd213c810f30e47ec92f1 /src | |
parent | 81fe80e8c075a9435dfb60056b9ff5a9072588f0 (diff) |
xserver: add RemoveLogFile()
Simple unlink() call to the logfile in use. The log file is only removed if
the server was started and terminated or finished successfully. If it was
never started or the startup failed for some reason, this function does
nothing. Behaviour can be overridden by forcing the removal.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/xserver.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/xserver.cpp b/src/xserver.cpp index 77b818c..863fdde 100644 --- a/src/xserver.cpp +++ b/src/xserver.cpp @@ -367,6 +367,12 @@ bool xorg::testing::XServer::Kill(unsigned int timeout) { return true; } +void xorg::testing::XServer::RemoveLogFile(bool force) { + enum Process::State state = GetState(); + if (force || state == Process::TERMINATED || state == Process::FINISHED_SUCCESS) + unlink(d_->options["-logfile"].c_str()); +} + void xorg::testing::XServer::SetOption(const std::string &key, const std::string &value) { d_->options[key] = value; } |