src/tools/disks/zfs.rs: allow empty zpool list output

This commit is contained in:
Dietmar Maurer 2020-06-08 07:23:04 +02:00
parent 044055062c
commit 7c3aa258f8
1 changed files with 3 additions and 0 deletions

View File

@ -153,6 +153,9 @@ fn parse_pool_status(i: &str) -> IResult<&str, ZFSPoolStatus> {
/// Note: This does not reveal any details on how the pool uses the devices, because /// Note: This does not reveal any details on how the pool uses the devices, because
/// the zpool list output format is not really defined... /// the zpool list output format is not really defined...
pub fn parse_zfs_list(i: &str) -> Result<Vec<ZFSPoolStatus>, Error> { pub fn parse_zfs_list(i: &str) -> Result<Vec<ZFSPoolStatus>, Error> {
if i.is_empty() {
return Ok(Vec::new());
}
match all_consuming(many1(parse_pool_status))(i) { match all_consuming(many1(parse_pool_status))(i) {
Err(nom::Err::Error(err)) | Err(nom::Err::Error(err)) |
Err(nom::Err::Failure(err)) => { Err(nom::Err::Failure(err)) => {