B #1964: SSH or LocalCommand hangs on large stderr (#1977)

* B #1964: Disable bash verbosity on tm_mad/ssh/mvds

* B #1964: SSH or LocalCommand hangs on large stderr
This commit is contained in:
Vlastimil Holer authored and Tino Vázquez committed 2018-04-18 18:50:50 +02:00
1 parent e1ab5cf3b0
commit 0c9c2e4880
2 files changed
+8 -21

No files matched your search

+7 -20
View File
@@ -83,22 +83,9 @@ class GenericCommand
def run
std = nil
process = Proc.new do
std = execute
@stdout, @stderr, _status = execute
# Close standard IO descriptors
if @stdin
std[0] << @stdin
std[0].flush
end
std[0].close if !std[0].closed?
@stdout=std[1].read
std[1].close if !std[1].closed?
@stderr=std[2].read
std[2].close if !std[2].closed?
@code=get_exit_code(@stderr)
@code = get_exit_code(@stderr)
if @code!=0
log("Command execution fail: #{command}")
@@ -161,8 +148,8 @@ class LocalCommand < GenericCommand
private
def execute
Open3.popen3("#{command} ; echo ExitCode: $? 1>&2",
:pgroup => true)
Open3.capture3("#{command} ; echo ExitCode: $? 1>&2",
:pgroup => true, :stdin_data => @stdin)
end
end
@@ -189,10 +176,10 @@ private
def execute
if @stdin
Open3.popen3("ssh #{@host} #{@command} ; echo ExitCode: $? 1>&2",
:pgroup => true)
Open3.capture3("ssh #{@host} #{@command} ; echo ExitCode: $? 1>&2",
:pgroup => true, :stdin_data => @stdin)
else
Open3.popen3("ssh -n #{@host} #{@command} ; echo ExitCode: $? 1>&2",
Open3.capture3("ssh -n #{@host} #{@command} ; echo ExitCode: $? 1>&2",
:pgroup => true)
end
end
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash -x
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2018, OpenNebula Project, OpenNebula Systems #