views:

1018

answers:

6

I've tried executing the following:

#!C:\cygwin\bin\bash.exe
ls ${WORKSPACE}

But that doesn't find ls (even if it's on the windows path). Is there any way to set this up?

UPDATE: In other words, I want to be able to set up a build step that uses cygwin bash instead of windows cmd like this page shows you how to do with Python.

+2  A: 

That shell-script has two errors: the hash-bang line should be "#!/bin/bash", and ${WORKSPACE} is not a shell-variable. Hudson has a bunch of variables of its own which are expanded in the commands you specify to be run (i.e. when you add commands in the web gui).

If you want to run Hudson build step on the Cygwin command line, you need to figure out what command Hudson runs and in which directory.

To give a more specific answer, you need to show us how your project is configured and what steps you want to run separately.

JesperE
I think I might have worded myself poorly. I'm wanting to run a command from cygwin in hudson (like this page shows you how to use python: http://wiki.hudson-ci.org/display/HUDSON/Shells)
Jason Baker
+1  A: 

you might want to try to give a full path to ls

/cygdrive/c/cygwin/bin/ls
webwesen
I can do that, but it would be kind of a PITA. :-)
Jason Baker
A: 

One other thing that seems to work is to use this:

#!C:\cygwin\bin\bash.exe
export PATH=$PATH:/usr/bin
ls

But it would be nice not to have to modify the path for every script.

Jason Baker
+3  A: 

So put your cygwin's bin directory in your PATH.

In case you don't know how to do it (Control Panel -> System -> Advanced -> Environment Variables), see: http://support.microsoft.com/kb/310519

lhunath
+1  A: 

Provided cygwin's bin folder is in your path, the following works for me:

#!/bin/sh
ls ${WORKSPACE}

I find Hudson does not pick up environment variable changes unless you restart the server.

Soo Wei Tan
+1  A: 

Have you thought about power shell? as much as I like cygwin, it's always been a little flaky, powershell is a solid fully functional shell on windows, another option is Windows Services for UNIX it gives you korn shell or c shell not quite as nice as bash but it gets the job done

Bob The Janitor