src/Pure/System/bash.scala
changeset 80227 af6b60c75d7d
parent 80224 db92e0b6a11a
child 80228 df84e8ff4839
equal deleted inserted replaced
80226:17a10bea79a1 80227:af6b60c75d7d
    42   def strings(ss: Iterable[String]): String =
    42   def strings(ss: Iterable[String]): String =
    43     ss.iterator.map(Bash.string).mkString(" ")
    43     ss.iterator.map(Bash.string).mkString(" ")
    44 
    44 
    45 
    45 
    46   /* process and result */
    46   /* process and result */
       
    47 
       
    48   def context(script: String,
       
    49     user_home: String = "",
       
    50     isabelle_identifier: String = "",
       
    51     cwd: Path = Path.current
       
    52   ): String = {
       
    53     if_proper(user_home,
       
    54       "export USER_HOME=" + Bash.string(user_home) + "\n") +
       
    55     if_proper(isabelle_identifier,
       
    56       "export ISABELLE_IDENTIFIER=" + Bash.string(isabelle_identifier) + "\n") +
       
    57     (if (cwd == null || cwd.is_current) "" else "cd " + quote(cwd.implode) + "\n") +
       
    58     script
       
    59   }
    47 
    60 
    48   private def make_description(description: String): String =
    61   private def make_description(description: String): String =
    49     proper_string(description) getOrElse "bash_process"
    62     proper_string(description) getOrElse "bash_process"
    50 
    63 
    51   def local_bash_process(): String =
    64   def local_bash_process(): String =