[elbe-devel] [PATCH 01/25] kvm.py - ensure to use string

Torben Hohn torben.hohn at linutronix.de
Tue Dec 5 17:30:41 CET 2017


On Fri, Dec 01, 2017 at 04:50:58PM +0100, Manuel Traut wrote:
> if line is an integer the compare will fail.

How can that happen ?
iterating over stdout should yield strings.

if not, then please do:

line = str (line)

and dont repeat str () 2 times.

> 
> Signed-off-by: Manuel Traut <manut at linutronix.de>
> ---
>  elbepack/kvm.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/elbepack/kvm.py b/elbepack/kvm.py
> index 2f2288a2..16e613a5 100644
> --- a/elbepack/kvm.py
> +++ b/elbepack/kvm.py
> @@ -32,8 +32,8 @@ def find_kvm_exe ():
>              # determine kvm version
>              cmd = subprocess.Popen (fname + ' --version', shell=True, stdout=subprocess.PIPE)
>              for line in cmd.stdout:
> -                if "version" in line:
> -                    version = line.split()[3].split('(')[0].strip()
> +                if "version" in str(line):
> +                    version = str(line).split()[3].split('(')[0].strip()
>  
>              if fname == "/usr/bin/qemu-system-x86_64":
>                  fname += " -enable-kvm"
> -- 
> 2.15.1
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Mit freundlichen Grüßen
Torben Hohn

Linutronix GmbH

Standort: Bremen

Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Firmensitz / Registered Office: D-88690 Uhldingen, Bahnhofstr. 3
Registergericht / Local District Court: Amtsgericht Freiburg i. Br.; HRB
Nr. / Trade register no.: 700 806

Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner

Eine Bitte von uns: Sollten Sie diese E-Mail irrtümlich erhalten haben,
benachrichtigen Sie uns in diesem Falle bitte sobald wie es Ihnen
möglich ist, durch Antwort-Mail. Vielen Dank!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20171205/949bef27/attachment.sig>


More information about the elbe-devel mailing list