From 915a63da5e94f85a8f0a211c73f9fafa77bc31f4 Mon Sep 17 00:00:00 2001 From: Jakub Filak Date: Mon, 24 Aug 2015 15:26:03 +0200 Subject: [PATCH] Add a sanity check to 'recordmydestkop' plugin Related: rhbz#1228860 Signed-off-by: Jakub Filak --- src/pyfros/plugins/screencastrecordmydesktop.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pyfros/plugins/screencastrecordmydesktop.py b/src/pyfros/plugins/screencastrecordmydesktop.py index 376b52b..63efd7d 100644 --- a/src/pyfros/plugins/screencastrecordmydesktop.py +++ b/src/pyfros/plugins/screencastrecordmydesktop.py @@ -17,14 +17,14 @@ from pyfros.screencastbase import ScreencastBase, ScreencastResult import pyfros.plugins.const as const -from subprocess import Popen, PIPE +from subprocess import Popen, PIPE, DEVNULL import fcntl import os import signal #pylint: disable=E0611 from gi.repository import GLib import re -from pyfros.froslogging import warn +from pyfros.froslogging import warn, error def getScreencastPluginInstance(): @@ -95,6 +95,13 @@ class ScreencastRecordMyDesktop(ScreencastBase): print("ScreencastArea ScreencastRecordMyDesktop") def IsSuitable(self): + try: + proc = Popen(["recordmydesktop", "-h"], stdin=DEVNULL, stdout=DEVNULL, stderr=DEVNULL) + proc.communicate() + except Exception as ex: + error("Cannot run 'recordmydesktop': %s" % (str(ex))) + return const.SUITABLE_NOT_SUITABLE + return const.SUITABLE_DEFAULT # 1 is default def Screencast(self): -- 2.5.0