Merge pull request #1672 from filecoin-project/feat/bisect-errors
Some chain-bisect improvements / fixes
This commit is contained in:
commit
85dc2eb36f
21
cli/chain.go
21
cli/chain.go
@ -692,7 +692,7 @@ var chainBisectCmd = &cli.Command{
|
||||
|
||||
highest, err := api.ChainGetTipSetByHeight(ctx, abi.ChainEpoch(end), types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("getting end tipset: %w", err)
|
||||
}
|
||||
|
||||
prev := highest.Height()
|
||||
@ -717,7 +717,7 @@ var chainBisectCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
b, err := json.MarshalIndent(nd, "", "\t")
|
||||
b, err := json.MarshalIndent(nd.Obj, "", "\t")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -726,15 +726,32 @@ var chainBisectCmd = &cli.Command{
|
||||
cmd.Stdin = bytes.NewReader(b)
|
||||
|
||||
var out bytes.Buffer
|
||||
var serr bytes.Buffer
|
||||
|
||||
cmd.Stdout = &out
|
||||
cmd.Stderr = &serr
|
||||
|
||||
switch cmd.Run().(type) {
|
||||
case nil:
|
||||
// it's lower
|
||||
if strings.TrimSpace(out.String()) != "false" {
|
||||
end = mid
|
||||
highest = midTs
|
||||
fmt.Println("true")
|
||||
} else {
|
||||
start = mid
|
||||
fmt.Printf("false (cli)\n")
|
||||
}
|
||||
case *exec.ExitError:
|
||||
if len(serr.String()) > 0 {
|
||||
fmt.Println("error")
|
||||
|
||||
fmt.Printf("> Command: %s\n---->\n", strings.Join(cctx.Args().Slice()[3:], " "))
|
||||
fmt.Println(string(b))
|
||||
fmt.Println("<----")
|
||||
return xerrors.Errorf("error running bisect check: %s", serr.String())
|
||||
}
|
||||
|
||||
start = mid
|
||||
fmt.Println("false")
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user