On Wed, Jul 11, 2012 at 7:47 PM, Eric in San Diego <eric.sc...@acm.org> wrote: > > It's very application specific, but it's "Object 'test' does not have a > field named 'test1' c:/path/to/importTest", suggesting that it's not > inferring the value of an 'I' parameter which should indicate a directory > within which to search for a file called 'test' which included some trivial > code that informs my test.
This doesn't sound like a problem with sh, but in the way you're calling it. Without a traceback, and some sample source though, it's harder to give useful feedback. Perhaps, you're doing something slightly unexpected, and the script isn't coping with it well? For instance, you're doing the equivalent of: (sh/sh "testApp" "-I c:/path/to/importTest") Instead of: (sh/sh "testApp" "-I" "c:/path/to/importTest") In the first case, testApp is called with 1 argument "-I c:/path/to/importTest". In the second case, it's called with 2 arguments, just as it would be with the shell. > I tried substituting a batch file (this is on windows) with the single line > in it, and get the same discrepency in behavior - the batch file works fine > when invoked from the shell, but fails when called with sh. This suggest to > me that it's nothing to do with clojure's processing of the arguments. Maybe > this has something to do with how the environment is represented? Is it the script that's failing? From sh, you should get a map of :in, :out, and :err. If you're getting that, then the problem is definitely lower (in the script) versus in sh. > I tried printing the value of sh/*sh-env* during my call, and it was 'nil', > but in order to call the app at all, it must have some knowledge of the > PATH. Does (null *sh-env*) then mean 'no changes to the default > environment'? IIRC, the "set" command will dump your environment in Windows. "env" will do it under Linux or Mac OS X. You can do: (print (sh/sh "env")) (print (sh/sh "set")) should work in Windows... but I don't run Windows, so I can't be certain. *sh-env* is a thread local binding, and can be used to customize the environment for several calls via (with-sh-env ...). The 'nil' you're seeing is the default binding value, which means "take the parent environment". (sh ...) does allow you to override the environment too using the :env keyword. -John -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en