Skip to content

Commit f846eff

Browse files
committed
Revert "Print done"
This reverts commit f00916f.
1 parent f00916f commit f846eff

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cgi-bin/webhook.cgi

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ require 'cgi'
66
require 'json'
77
require 'logger'
88
require 'openssl'
9-
require 'shellwords'
109

1110
class Webhook
1211
LOG_PATH = '/tmp/webhook.log'
@@ -185,10 +184,13 @@ class PushHook
185184
end
186185

187186
def execute(*cmd, user:)
187+
require 'open3'
188188
cmd = ['/usr/bin/sudo', '-u', user, *cmd]
189-
logger.info("+ #{cmd.shelljoin}")
190-
system("#{cmd.shelljoin} > #{Webhook::LOG_PATH} 2>&1")
191-
logger.info("done")
189+
logger.info("+ #{cmd.join(' ')}")
190+
stdout, stderr, status = Open3.capture3(*cmd)
191+
logger.info("success: #{status.success?}")
192+
logger.info("stdout: #{stdout}")
193+
logger.info("stderr: #{stderr}")
192194
end
193195
end
194196

0 commit comments

Comments
 (0)