1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-19 06:50:07 +03:00

Solves issues dealing with pager for CLI

(cherry picked from commit 58af3b5ec9041ebee1bfc08b922359294ef19373)
This commit is contained in:
Ruben S. Montero 2018-09-10 20:03:21 +02:00
parent 08bfc40b72
commit ba32d6ddb6
2 changed files with 18 additions and 1 deletions

View File

@ -541,7 +541,10 @@ EOT
def stop_pager(lpid)
$stdout.close
Process.wait(lpid)
begin
Process.wait(lpid)
rescue Errno::ECHILD
end
end
def print_page(pool, options)
@ -599,6 +602,9 @@ EOT
if elements < size
return 0
elsif !pool.is_paginated?
stop_pager(ppid)
return 0
end
# ------- Rest of the pages in the pool, piped to pager --------
@ -613,6 +619,12 @@ EOT
current += size
begin
Process.waitpid(ppid, Process::WNOHANG)
rescue Errno::ECHILD
break
end
elements, hash = print_page(pool, options)
table.show(hash, options)

View File

@ -247,5 +247,10 @@ module OpenNebula
return rc
end
# Return true if pool is paginated
def is_paginated?
PAGINATED_POOLS.include?(@pool_name)
end
end
end