Hi there i am trying to run a sh script I wrote and fire it from a javascript file I have.
I seem to find the file and execute but not everything. If you take a look here at a section of .sh file
# Add files from public folder
# Get commit desciption message
# Commit changess
git add public/*
if [ "$(git diff ${BRANCH} -- ${SRC} --quiet --exit-code --cached)" ]
then
echo "line 1"
read -p "${BLUE}Commit description: ${RESET}" desc
git commit -m "$desc" -- public
echo "line two"
read -p "Do you want to push these commits? [y]/n " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
pushing
else
echo "${RED}Push canceled. Goodbye!${RESET}"
fi
else
echo "${RED}Noting to commit. Goodbye!${RESET}"
fi
It works all the way down as far as the first read command where it then freezes. I have tried removing colours ect.
To execute I have tried both shellJs and using child process like so,
var exec = require('child_process').exec, child;
var testscript = exec('sh tools/publish.sh /tools');
testscript.stdout.on('data', function(data){
console.log(data);
});
testscript.stderr.on('data', function(data){
console.log(data);
});
Both shellJs and this method get the same result it print "line one then freezes.
Can someone help with this would be great. If you need to see more code just let me know thanks.
via Alex Kirwan
No comments:
Post a Comment