Forum: Rails deployment Can't execute command via Open3.popen3

19168f90634d83872ca3803b328b3c41?d=identicon&s=25 Peter Marks (petermarks)
on 2010-11-10 04:01
I'm implemented the "Github Hook" redmine plugin. It's supposed to
execute a git command on my server via Open3.popen3 using this method:

def exec(command)
  logger.info  "GithubHook: Executing command: '#{command}'"
  stdin, stdout, stderr = Open3.popen3(command)

  output = stdout.readlines.collect(&:strip)
  errors = stderr.readlines.collect(&:strip)

  logger.info  "GithubHook: Output from git:"
  logger.info  "GithubHook:  * STDOUT: #{output}"
  logger.info  "GithubHook:  * STDERR: #{output}"
end

However, the command doesn't execute. It does what it's supposed to do
when I execute it manually. Here's the response from the log messages:

GithubHook: Executing command: 'cd '/home/me/repositories/app/.git/' &&
git fetch origin && git reset --soft refs/remotes/origin/master'
GithubHook: Output from git:
GithubHook:  * STDOUT:
GithubHook:  * STDERR:

I've never worked with Open3.popen3 before. What about my environment
(an ubuntu Hardy slice host box) might be preventing execution.

Thanks in advance!

Peter
This topic is locked and can not be replied to.