Solves issues dealing with pager for CLI

(cherry picked from commit 58af3b5ec9)
This commit is contained in:
Ruben S. Montero committed 2018-09-10 20:04:37 +02:00
1 parent 08bfc40b72
commit ba32d6ddb6
2 files changed
+18 -1

No files matched your search

+13 -1
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)
+5
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