mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
Expose eval.HasFailure
This commit is contained in:
parent
f68b0eb1f9
commit
6dfa18bf4c
|
@ -43,7 +43,7 @@ type evalCtx struct {
|
|||
ports []*port
|
||||
}
|
||||
|
||||
func hasFailure(vs []Value) bool {
|
||||
func HasFailure(vs []Value) bool {
|
||||
for _, v := range vs {
|
||||
v, ok := v.(exitus)
|
||||
if !ok {
|
||||
|
@ -95,7 +95,7 @@ func printExitus(e exitus) {
|
|||
}
|
||||
|
||||
func PrintExituses(vs []Value) {
|
||||
if !hasFailure(vs) {
|
||||
if !HasFailure(vs) {
|
||||
return
|
||||
}
|
||||
fmt.Print("Status: ")
|
||||
|
|
|
@ -159,7 +159,7 @@ func (c *closure) Exec(ec *evalCtx, args []Value) <-chan *stateUpdate {
|
|||
}
|
||||
// Ports are closed after executaion of closure is complete.
|
||||
ec.closePorts()
|
||||
if hasFailure(vs) {
|
||||
if HasFailure(vs) {
|
||||
// TODO(xiaq): Wrap the original failure
|
||||
update <- newExitedStateUpdate(newFailure("chunk failure"))
|
||||
} else {
|
||||
|
|
|
@ -33,7 +33,7 @@ func combineChunk(ops []valuesOp) valuesOp {
|
|||
f := func(ec *evalCtx) []Value {
|
||||
for _, op := range ops {
|
||||
s := op.f(ec)
|
||||
if hasFailure(s) {
|
||||
if HasFailure(s) {
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user