src/Pure/System/process_result.scala
changeset 62402 bff56eae3ec5
parent 62401 15a2533f1f0a
child 62404 13a0f537e232
equal deleted inserted replaced
62401:15a2533f1f0a 62402:bff56eae3ec5
     5 */
     5 */
     6 
     6 
     7 package isabelle
     7 package isabelle
     8 
     8 
     9 final case class Process_Result(
     9 final case class Process_Result(
    10   out_lines: List[String], err_lines: List[String], rc: Int, timeout: Option[Time])
    10   rc: Int,
       
    11   out_lines: List[String] = Nil,
       
    12   err_lines: List[String] = Nil,
       
    13   timeout: Option[Time] = None)
    11 {
    14 {
    12   def out: String = cat_lines(out_lines)
    15   def out: String = cat_lines(out_lines)
    13   def err: String = cat_lines(err_lines)
    16   def err: String = cat_lines(err_lines)
    14 
    17 
    15   def error(s: String, err_rc: Int = 0): Process_Result =
    18   def error(s: String, err_rc: Int = 0): Process_Result =
    23   def check: Process_Result =
    26   def check: Process_Result =
    24     if (ok) this
    27     if (ok) this
    25     else if (interrupted) throw Exn.Interrupt()
    28     else if (interrupted) throw Exn.Interrupt()
    26     else Library.error(err)
    29     else Library.error(err)
    27 
    30 
       
    31   def clear: Process_Result = copy(out_lines = Nil, err_lines = Nil)
       
    32 
    28   def print: Process_Result =
    33   def print: Process_Result =
    29   {
    34   {
    30     Output.warning(Library.trim_line(err))
    35     Output.warning(Library.trim_line(err))
    31     Output.writeln(Library.trim_line(out))
    36     Output.writeln(Library.trim_line(out))
    32     copy(out_lines = Nil, err_lines = Nil)
    37     clear
    33   }
    38   }
    34 }
    39 }