# Can't execute command via Open3.popen3

**URL:** <https://www.ruby-forum.com/t/cant-execute-command-via-open3-popen3/198889>\
**Category:** Deployment\
**Created:** [November 10, 2010, 4:01am UTC](https://www.ruby-forum.com/t/cant-execute-command-via-open3-popen3/198889 "2010-11-10T04:01:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [November 10, 2010, 4:01am UTC](https://www.ruby-forum.com/t/cant-execute-command-via-open3-popen3/198889/1 "2010-11-10T04:01:06Z")

</div>

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
