func IsFailed(ctx context.Context, unit string, opts Options) (bool, error) {
	var args = []string{"is-failed", "--system", unit}
	if opts.UserMode {
		args[1] = "--user"
	}
	stdout, _, _, err := execute(ctx, args)
	if matched, _ := regexp.MatchString(`inactive`, stdout); matched {
		return false, nil
	} else if matched, _ := regexp.MatchString(`active`, stdout); matched {
		return false, nil
	} else if matched, _ := regexp.MatchString(`failed`, stdout); matched {
		return true, nil
	}
	return false, err
}
// Check whether any of the specified units are in a "failed" state.
Check whether any of the specified units are in a "failed" state.
// Check whether any of the specified units are in a " failed " state .
func IsFailed(ctx context.Context, unit string, opts Options) (bool, error) {
	var args = []string{"is-failed", "--system", unit}
	if opts.UserMode {
		args[1] = "--user"
	}
	stdout, _, _, err := execute(ctx, args)
	if matched, _ := regexp.MatchString(`inactive`, stdout); matched {
		return false, nil
	} else if matched, _ := regexp.MatchString(`active`, stdout); matched {
		return false, nil
	} else if matched, _ := regexp.MatchString(`failed`, stdout); matched {
		return true, nil
	}
	return false, err
}
func IsFailed ( ctx context . Context , unit string , opts Options ) ( bool , error ) { var args = [ ] string { " " , " " , unit } if opts . UserMode { args [ 1 ] = " " } stdout , _ , _ , err := execute ( ctx , args ) if matched , _ := regexp . MatchString ( `inactive` , stdout ) ; matched { return false , nil } else if matched , _ := regexp . MatchString ( `active` , stdout ) ; matched { return false , nil } else if matched , _ := regexp . MatchString ( `failed` , stdout ) ; matched { return true , nil } return false , err }
Check whether any of the specified units are in a "failed" state.
Check whether any of the specified units are in a " failed " state .