1

When I run grunt from the command line, it works fine, but if I create a Sublime Text 2 build it "seems" to run fine except that anywhere process.env.SOME_VARIABLE is used it comes back as undefined.

Basically, from ST2 the following:

dest = process.env.CATALINA_HOME + "/webapps/MyApp/"

returns

"undefined/webapps/MyApp"

All of my files get copied to a new "undefined" directory in the project path rather than the Tomcat directory where it's supposed to be deployed to.

Is there any way to get Sublime Text 2 to respect/recognize node's process.env variables?

Jason
  • 2,280
  • 23
  • 22

1 Answers1

1

Sublime is starting a new process to run your build that does not seem to have the environment variables set as you have in your command line.

You could use an extra env option in the build definition, where you pass the necessary environment variables to the new process.

It accepts a JSON object like this:

env: {"SOME_VARIABLE": "/full/path/to/something"}

You can take a look at the available options and some better description of the env option at this link: http://sublimetext.info/docs/en/reference/build_systems.html#options

Jonas
  • 1,692
  • 13
  • 17
  • 1
    Thanks! After your post I did a search for how to format the **env** option and found the answer here: http://stackoverflow.com/questions/8574919/sublime-text-2-custom-path-and-pythonpath Basically, env needs to be set up as a JSON object like so: env: {"CATALINA_HOME": "/full/path/to/tomcat"} – Jason May 02 '13 at 02:50
  • 1
    @Jason Thanks, I will also add the info to the answer, to make it more complete. – Jonas May 11 '13 at 17:41