Skip to content

Commit

Permalink
Perl CPAN Support, Frozen cpanm Command, Fix Broken I/O Handling In e…
Browse files Browse the repository at this point in the history
…xecmd(), Part 1
  • Loading branch information
wbraswell committed Jul 4, 2018
1 parent 373cb65 commit 3171ee9
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/fpm/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,19 @@ def execmd(*args)
stdout_w.close; stderr_w.close
logger.info("Process is running", :pid => process.pid)
if block_given?
# if false # allows output & cures gcc/as hang, but re-introduces Inline::CPP interactive build hang
args3 = []
args3.push(process) if opts[:process]
args3.push(process.io.stdin) if opts[:stdin]
args3.push(stdout_r) if opts[:stdout]
args3.push(stderr_r) if opts[:stderr]
# args3.push(stdout_r) if opts[:stdout]
# args3.push(stderr_r) if opts[:stderr]

yield(*args3)

process.io.stdin.close if opts[:stdin] and not process.io.stdin.closed?
stdout_r.close unless stdout_r.closed?
stderr_r.close unless stderr_r.closed?
# process.io.stdin.close if opts[:stdin] and not process.io.stdin.closed?
# stdout_r.close unless stdout_r.closed?
# stderr_r.close unless stderr_r.closed?
logger.pipe(stdout_r => :info, stderr_r => :info)
else
# Log both stdout and stderr as 'info' because nobody uses stderr for
# actually reporting errors and as a result 'stderr' is a misnomer.
Expand Down Expand Up @@ -249,9 +251,9 @@ def safesystemin(*args)
logger.info("[[[ DEBUG CHECKPOINT, safesystemin(), 122 ]]]")
stdin.close
logger.info("[[[ DEBUG CHECKPOINT, safesystemin(), 123 ]]]")
stdout_r_str = stdout.read
# stdout_r_str = stdout.read
logger.info("[[[ DEBUG CHECKPOINT, safesystemin(), 124 ]]]")
stderr_r_str = stderr.read
# stderr_r_str = stderr.read
logger.info("[[[ DEBUG CHECKPOINT, safesystemin(), 125 ]]]")
end
logger.info("[[[ DEBUG CHECKPOINT, safesystemin(), 126 ]]]")
Expand Down

0 comments on commit 3171ee9

Please sign in to comment.