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

Posted by 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.