more accurate treatment of surrounding whitespace;
authorwenzelm
Wed, 08 Nov 2023 13:00:24 +0100
changeset 78915 90756ad4d8d7
parent 78914 715f1bd21993
child 78916 e97fa2edf4b2
more accurate treatment of surrounding whitespace;
src/Pure/System/benchmark.scala
src/Pure/System/options.scala
src/Pure/Tools/build.scala
--- a/src/Pure/System/benchmark.scala	Wed Nov 08 12:41:41 2023 +0100
+++ b/src/Pure/System/benchmark.scala	Wed Nov 08 13:00:24 2023 +0100
@@ -16,7 +16,7 @@
   ): String = {
     val options = Options.Spec("build_hostname", Some(host.name)) :: host.options
     ssh.bash_path(isabelle_home + Path.explode("bin/isabelle")) + " benchmark" +
-      Options.Spec.bash_strings(options)
+      Options.Spec.bash_strings(options, bg = true)
   }
 
   def benchmark(options: Options, progress: Progress = new Progress()): Unit = {
--- a/src/Pure/System/options.scala	Wed Nov 08 12:41:41 2023 +0100
+++ b/src/Pure/System/options.scala	Wed Nov 08 13:00:24 2023 +0100
@@ -41,8 +41,14 @@
 
     def print(name: String, value: String): String = Properties.Eq(name, print_value(value))
 
-    def bash_strings(opts: Iterable[Spec]): String =
-      opts.iterator.map(opt => "-o " + Bash.string(opt.toString)).mkString(" ", " ", " ")
+    def bash_strings(opts: Iterable[Spec], bg: Boolean = false, en: Boolean = false): String = {
+      val it = opts.iterator
+      if (it.isEmpty) ""
+      else {
+        it.map(opt => "-o " + Bash.string(opt.toString))
+          .mkString(if (bg) " " else "", " ", if (en) " " else "")
+      }
+    }
   }
 
   sealed case class Spec(name: String, value: Option[String] = None, permissive: Boolean = false) {
--- a/src/Pure/Tools/build.scala	Wed Nov 08 12:41:41 2023 +0100
+++ b/src/Pure/Tools/build.scala	Wed Nov 08 13:00:24 2023 +0100
@@ -589,7 +589,7 @@
       if_proper(afp_root, " -A " + ssh.bash_path(afp_root.get)) +
       dirs.map(dir => " -d " + ssh.bash_path(dir)).mkString +
       if_proper(host.numa, " -N") + " -j" + host.jobs +
-      Options.Spec.bash_strings(options) +
+      Options.Spec.bash_strings(options, bg = true) +
       if_proper(quiet, " -q") +
       if_proper(verbose, " -v")
   }