change system to popen
This commit is contained in:
parent
deb42a19d0
commit
154aecfa14
|
@ -17,6 +17,7 @@ class PullRequestsController < ApplicationController
|
|||
require 'json'
|
||||
require 'open-uri'
|
||||
require 'uri'
|
||||
require 'string.io' # add by zxh: 将控制台shell命令输出到指定位置
|
||||
|
||||
# 返回json格式
|
||||
def index
|
||||
|
@ -335,8 +336,16 @@ class PullRequestsController < ApplicationController
|
|||
pushTXInfoJson = pushTXInfo.to_json
|
||||
# 发送交易
|
||||
Rails.logger.info("before executing chain_trustie command...")
|
||||
result = system "chain_trustie pushPRTX " + pushTXInfoJson
|
||||
Rails.logger.info(result)
|
||||
cmd = "chain_trustie pushPRTX " + pushTXInfoJson
|
||||
# result = system # 执行失败了
|
||||
output = StringIO.new
|
||||
IO.popen(cmd) do |pipe|
|
||||
pipe.each do |line|
|
||||
Rails.logger.info(line)
|
||||
end
|
||||
end
|
||||
Rails.logger.info(output.string)
|
||||
# Rails.logger.info(result)
|
||||
Rails.logger.info("after executing chain_trustie command...")
|
||||
# add by zxh end
|
||||
|
||||
|
|
Loading…
Reference in New Issue