1

I'm trying to make a rails controller pull the latest content from a repo on bit bucket. To the most part this is a success the only issue I have whilst testing I can only seem to get the page to output the first line the script returns and that seems to not run the rest of the script any ideas

Here is my bash script

#!/bin/bash -l
GIT_REPO='IMAREPO'
TMP_GIT_CLONE=TEMPPATH
PUBLIC_WWW=SITEPATH

if [ -d $TMP_GIT_CLONE ]; then
   rm -Rf $TMP_GIT_CLONE
fi
git clone $GIT_REPO $TMP_GIT_CLONE
jekyll build --source $TMP_GIT_CLONE --destination $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit

and in the rails controller I am doing

@result = %x[/var/srv/pulldevelopment.sh]

Which in turn only out put a single line from the script which is

Cloning into '/root/tmp/git/blah'...

2
  • Is there anything in that script that outputs to stderr instead of stdout? Maybe you need something like %x[script.sh 2>&1] Commented Jan 16, 2014 at 20:50
  • Thanks that help actually find the problem (yet to fix it however) It seems that jekyll is trying to run under rails causing some gem issues and "invalid byte sequence in US-ASCII Error" in my markdown files.. is there a way to not run the jekyll under my rails app? Commented Jan 16, 2014 at 22:03

1 Answer 1

1

Yes, this is expected. By default Git only prints progress status if stderr is connected to a TTY. You can reproduce this behavior in a terminal with:

$ git clone $GIT_REPO 2>&1 | cat

Pass --progress to always get progress status on the stderr stream. See git-clone(1).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.