clarified modules and signatures;
authorwenzelm
Thu, 01 Jul 2021 13:46:42 +0200
changeset 73911 a8c5ee444991
parent 73910 c678e58cf999
child 73912 ac1639349ecf
clarified modules and signatures;
Admin/components/components.sha1
Admin/components/main
src/Pure/General/file.scala
src/Pure/System/bash.scala
src/Pure/System/isabelle_system.scala
src/Tools/Setup/src/isabelle/setup/Environment.java
--- a/Admin/components/components.sha1	Thu Jul 01 12:34:42 2021 +0200
+++ b/Admin/components/components.sha1	Thu Jul 01 13:46:42 2021 +0200
@@ -122,6 +122,7 @@
 9467ad54a9ac10a6e7e8db5458d8d2a5516eba96  isabelle_fonts-20210321.tar.gz
 1f7a0b9829ecac6552b21e995ad0f0ac168634f3  isabelle_fonts-20210322.tar.gz
 916adccd2f40c55116b68b92ce1eccb24d4dd9a2  isabelle_setup-20210630.tar.gz
+c611e363287fcc9bdd93c33bef85fa4e66cd3f37  isabelle_setup-20210701.tar.gz
 0b2206f914336dec4923dd0479d8cee4b904f544  jdk-11+28.tar.gz
 e12574d838ed55ef2845acf1152329572ab0cc56  jdk-11.0.10+9.tar.gz
 3e05213cad47dbef52804fe329395db9b4e57f39  jdk-11.0.2+9.tar.gz
--- a/Admin/components/main	Thu Jul 01 12:34:42 2021 +0200
+++ b/Admin/components/main	Thu Jul 01 13:46:42 2021 +0200
@@ -8,7 +8,7 @@
 flatlaf-1.2
 idea-icons-20210508
 isabelle_fonts-20210322
-isabelle_setup-20210630
+isabelle_setup-20210701
 jdk-15.0.2+7
 jedit_build-20210510-1
 jfreechart-1.5.1
--- a/src/Pure/General/file.scala	Thu Jul 01 12:34:42 2021 +0200
+++ b/src/Pure/General/file.scala	Thu Jul 01 13:46:42 2021 +0200
@@ -29,7 +29,7 @@
   def standard_path(path: Path): String = path.expand.implode
 
   def standard_path(platform_path: String): String =
-    isabelle.setup.Environment.standard_path(Isabelle_System.cygwin_root(), platform_path)
+    isabelle.setup.Environment.standard_path(platform_path)
 
   def standard_path(file: JFile): String = standard_path(file.getPath)
 
@@ -46,7 +46,7 @@
   /* platform path (Windows or Posix) */
 
   def platform_path(standard_path: String): String =
-    isabelle.setup.Environment.platform_path(Isabelle_System.cygwin_root(), standard_path)
+    isabelle.setup.Environment.platform_path(standard_path)
 
   def platform_path(path: Path): String = platform_path(standard_path(path))
   def platform_file(path: Path): JFile = new JFile(platform_path(path))
--- a/src/Pure/System/bash.scala	Thu Jul 01 12:34:42 2021 +0200
+++ b/src/Pure/System/bash.scala	Thu Jul 01 13:46:42 2021 +0200
@@ -47,21 +47,6 @@
 
   type Watchdog = (Time, Process => Boolean)
 
-  def process_signal(group_pid: String, signal: String = "0"): Boolean =
-  {
-    val cmd = new LinkedList[String]
-    if (Platform.is_windows) {
-      cmd.add(Isabelle_System.cygwin_root() + "\\bin\\bash.exe")
-    }
-    else {
-      cmd.add("/usr/bin/env")
-      cmd.add("bash")
-    }
-    cmd.add("-c")
-    cmd.add("kill -" + signal + " -" + group_pid)
-    isabelle.setup.Environment.exec_process(cmd, null, null, false).ok
-  }
-
   def process(script: String,
       cwd: JFile = null,
       env: JMap[String, String] = Isabelle_System.settings(),
@@ -133,8 +118,10 @@
     {
       count <= 0 ||
       {
-        process_signal(group_pid, signal = s)
-        val running = root_process_alive() || process_signal(group_pid)
+        isabelle.setup.Environment.kill_process(group_pid, s)
+        val running =
+          root_process_alive() ||
+          isabelle.setup.Environment.kill_process(group_pid, "0")
         if (running) {
           Time.seconds(0.1).sleep()
           signal(s, count - 1)
@@ -152,7 +139,7 @@
 
     def interrupt(): Unit = Isabelle_Thread.try_uninterruptible
     {
-      process_signal(group_pid, "INT")
+      isabelle.setup.Environment.kill_process(group_pid, "INT")
     }
 
 
--- a/src/Pure/System/isabelle_system.scala	Thu Jul 01 12:34:42 2021 +0200
+++ b/src/Pure/System/isabelle_system.scala	Thu Jul 01 13:46:42 2021 +0200
@@ -27,8 +27,6 @@
     proper_string(getenv(name, env)) getOrElse
       error("Undefined Isabelle environment variable: " + quote(name))
 
-  def cygwin_root(): String = getenv("CYGWIN_ROOT")
-
 
   /* services */
 
--- a/src/Tools/Setup/src/isabelle/setup/Environment.java	Thu Jul 01 12:34:42 2021 +0200
+++ b/src/Tools/Setup/src/isabelle/setup/Environment.java	Thu Jul 01 13:46:42 2021 +0200
@@ -333,4 +333,44 @@
             _settings = Map.copyOf(settings);
         }
     }
+
+
+    /* Cygwin root (after init) */
+
+    public static String cygwin_root()
+        throws IOException, InterruptedException
+    {
+        return settings().getOrDefault("CYGWIN_ROOT", "");
+    }
+
+    public static String standard_path(String platform_path)
+        throws IOException, InterruptedException
+    {
+        return standard_path(cygwin_root(), platform_path);
+    }
+
+    public static String platform_path(String standard_path)
+        throws IOException, InterruptedException
+    {
+        return platform_path(cygwin_root(), standard_path);
+    }
+
+
+    /* kill process (via bash) */
+
+    static public boolean kill_process(String group_pid, String signal)
+        throws IOException, InterruptedException
+    {
+        List<String> cmd = new LinkedList<String>();
+        if (is_windows()) {
+            cmd.add(cygwin_root() + "\\bin\\bash.exe");
+        }
+        else {
+            cmd.add("/usr/bin/env");
+            cmd.add("bash");
+        }
+        cmd.add("-c");
+        cmd.add("kill -" + signal + " -" + group_pid);
+        return exec_process(cmd, null, null, false).ok();
+    }
 }