Hello,
I’m trying to run a shell script with gradle. I currently have something like this
def test = project.tasks.create("test", Exec) {
commandLine 'bash', '-c', 'bash C:/my file dir/script.sh'
}
The problem is that I cannot run this script because i have spaces in my dir name. I have tried everything e.g:
commandLine 'bash', '-c', 'bash C:/my file dir/script.sh'.tokenize()
commandLine 'bash', '-c', ['bash', 'C:/my file dir/script.sh']
commandLine 'bash', '-c', new StringBuilder().append('bash').append('C:/my file dir/script.sh')
commandLine 'bash', '-c', 'bash "C:/my file dir/script.sh"'
File dir = file('C:/my file dir/script.sh')
commandLine 'bash', '-c', 'bash ' + dir.getAbsolutePath();
Im using windows7 64bit and if I use a path without spaces the script runs perfectly, therefore the only issue as I can see is how gradle handles spaces.