[v2,4/5] kernel-shark: Optimize the error messages when "Record" fails to start
diff mbox series

Message ID 20190826155811.32021-5-y.karadz@gmail.com
State Superseded
Headers show
Series
  • Handle the case when KernelShark is started as Root
Related show

Commit Message

Yordan Karadzhov (VMware) Aug. 26, 2019, 3:58 p.m. UTC
Removing duplicate code.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/KsMainWindow.cpp | 14 +++++++-------
 kernel-shark/src/KsMainWindow.hpp |  2 ++
 2 files changed, 9 insertions(+), 7 deletions(-)

Patch
diff mbox series

diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp
index 73d6877..651cf59 100644
--- a/kernel-shark/src/KsMainWindow.cpp
+++ b/kernel-shark/src/KsMainWindow.cpp
@@ -1199,18 +1199,18 @@  void KsMainWindow::_captureFinished(int ret, QProcess::ExitStatus st)
 		return;
 	}
 
-	if (ret != 0 && st == QProcess::NormalExit) {
-		QString message = "Capture process failed:<br>";
-
-		message += capture->errorString();
-		message += capture->readAllStandardError();
-		_error(message, "captureFinishedErr", false, false);
-	}
+	if (ret != 0 && st == QProcess::NormalExit)
+		_captureErrorMessage(capture);
 }
 
 void KsMainWindow::_captureError(QProcess::ProcessError error)
 {
 	QProcess *capture = (QProcess *)sender();
+	_captureErrorMessage(capture);
+}
+
+void KsMainWindow::_captureErrorMessage(QProcess *capture)
+{
 	QString message = "Capture process failed:<br>";
 
 	message += capture->errorString();
diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp
index 4a7b8ab..eef4f96 100644
--- a/kernel-shark/src/KsMainWindow.hpp
+++ b/kernel-shark/src/KsMainWindow.hpp
@@ -215,6 +215,8 @@  private:
 
 	void _captureError(QProcess::ProcessError error);
 
+	void _captureErrorMessage(QProcess *capture);
+
 	void _readSocket();
 
 	void _splitterMoved(int pos, int index);