more robust;
authorwenzelm
Thu, 19 Dec 2019 22:21:43 +0100
changeset 71327 a89729bdde89
parent 71326 d85258458623
child 71328 4642a81f5913
more robust;
src/Pure/System/linux.scala
--- a/src/Pure/System/linux.scala	Thu Dec 19 22:13:47 2019 +0100
+++ b/src/Pure/System/linux.scala	Thu Dec 19 22:21:43 2019 +0100
@@ -71,7 +71,11 @@
     progress.bash("apt-get install -y -- " + Bash.strings(packages), echo = true).check
 
   def package_installed(name: String): Boolean =
-    Isabelle_System.bash("dpkg-query -s " + Bash.string(name)).ok
+  {
+    val result = Isabelle_System.bash("dpkg-query -s " + Bash.string(name))
+    val pattern = """^Status:.*installed.*$""".r.pattern
+    result.ok && result.out_lines.exists(line => pattern.matcher(line).matches)
+  }
 
 
   /* users */