src/Pure/System/isabelle_system.scala
changeset 72362 5f17bf3709b8
parent 72214 5924c1da3c45
child 72375 e48d93811ed7
equal deleted inserted replaced
72361:178cbf89780e 72362:5f17bf3709b8
   366 
   366 
   367     if (gnutar_check) bash("tar " + options + args, redirect = redirect)
   367     if (gnutar_check) bash("tar " + options + args, redirect = redirect)
   368     else error("Expected to find GNU tar executable")
   368     else error("Expected to find GNU tar executable")
   369   }
   369   }
   370 
   370 
       
   371   private lazy val curl_check: Unit =
       
   372     try { bash("curl --version").check }
       
   373     catch { case ERROR(_) => error("Cannot download files: missing curl") }
       
   374 
       
   375   def download(url: String, file: Path, progress: Progress = new Progress): Unit =
       
   376   {
       
   377     curl_check
       
   378     progress.echo("Getting " + quote(url))
       
   379     try {
       
   380       bash("curl --fail --silent --location " + Bash.string(url) +
       
   381         " > " + File.bash_path(file)).check
       
   382     }
       
   383     catch { case ERROR(msg) => cat_error("Failed to download " + quote(url), msg) }
       
   384   }
       
   385 
   371   def hostname(): String = bash("hostname -s").check.out
   386   def hostname(): String = bash("hostname -s").check.out
   372 
   387 
   373   def open(arg: String): Unit =
   388   def open(arg: String): Unit =
   374     bash("exec \"$ISABELLE_OPEN\" " + Bash.string(arg) + " >/dev/null 2>/dev/null &")
   389     bash("exec \"$ISABELLE_OPEN\" " + Bash.string(arg) + " >/dev/null 2>/dev/null &")
   375 
   390