Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mirage/mirage
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6ac5dc76abe8
Choose a base ref
...
head repository: mirage/mirage
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2f5927abe8cc
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Jan 29, 2015

  1. Fixed missing log error

    When not redirecting output, don't try to read the log file on error.
    Error was:
    
    mirage: internal error, uncaught exception:
    	Sys_error("log: No such file or directory")
    talex5 committed Jan 29, 2015
    Copy the full SHA
    55f3f73 View commit details
  2. Merge pull request #355 from talex5/log-error

    Fix missing log error
    avsm committed Jan 29, 2015
    Copy the full SHA
    2f5927a View commit details
Showing with 11 additions and 9 deletions.
  1. +11 −9 lib/mirage_misc.ml
20 changes: 11 additions & 9 deletions lib/mirage_misc.ml
Original file line number Diff line number Diff line change
@@ -209,23 +209,25 @@ let command ?(redirect=true) fmt =
Printf.kprintf (fun cmd ->
info "%s %s" (yellow_s "=>") cmd;
let redirect fn =
if redirect then
with_redirect stdout "log" (fun () ->
if redirect then (
let status =
with_redirect stdout "log" (fun () ->
with_redirect stderr "log" fn
)
else (
) in
if status <> 0 then (
let ic = open_in "log" in
try while true do error_msg !section "%s" (input_line ic) done;
with End_of_file -> ()
);
status
) else (
flush stdout;
flush stderr;
fn ()
) in
match redirect (fun () -> Sys.command cmd) with
| 0 -> ()
| i ->
let ic = open_in "log" in
begin
try while true do error_msg !section "%s" (input_line ic) done
with End_of_file -> ()
end;
error "The command %S exited with code %d." cmd i;
) fmt