Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Better handling of the user environment #20

Merged
merged 1 commit into from

3 participants

@FredrikAppelros

A backup of the user environment is now taken during a call to start instead of during the launch of the task. This allows for changing the user environment when the express server is run using nospawn (as with grunt-contrib-watch).

With this fix it is now possible to change the environment with grunt-env before launching an express server with grunt-contrib-watch.

@FredrikAppelros FredrikAppelros Better handling of the user environment
A backup of the user environment is now taken during a call to start
instead of during the launch of the task. This allows for changing the
user environment when the express server is run using nospawn (as with
grunt-contrib-watch).
bfe4f19
@FredrikAppelros

I didn't update the version in package.json but it would be great if you could do that so that the new version will be available on npm.

@matogertel

Was looking at exactly the same problem now! Was doing my head! Thank you for the fix, I'll use your branch until the official package is updated.

@ericclemmons ericclemmons merged commit 0e9c078 into ericclemmons:master
@ericclemmons
Owner

Just published v0.4.2 for you guys!

@FredrikAppelros

I believe the last version was 0.4.3 so shouldn't the new one be 0.4.4? It doesn't seem to have been updated over at npm.

@ericclemmons
Owner

WHOOPS! I updated the wrong repo! :D (grunt-angular-templates)

@ericclemmons
Owner
l ~ ⮁ Sites ⮁ ericclemmons ⮁ grunt-express-server ⮀ master ⮀ $ ⮀npm publish
npm http PUT https://registry.npmjs.org/grunt-express-server
npm http 409 https://registry.npmjs.org/grunt-express-server
npm http GET https://registry.npmjs.org/grunt-express-server
npm http 200 https://registry.npmjs.org/grunt-express-server
npm http PUT https://registry.npmjs.org/grunt-express-server/-/grunt-express-server-0.4.4.tgz/-rev/15-119d2f1381ca2550c18e491510bf539d
npm http 201 https://registry.npmjs.org/grunt-express-server/-/grunt-express-server-0.4.4.tgz/-rev/15-119d2f1381ca2550c18e491510bf539d
npm http PUT https://registry.npmjs.org/grunt-express-server/0.4.4/-tag/latest
npm http 201 https://registry.npmjs.org/grunt-express-server/0.4.4/-tag/latest
+ grunt-express-server@0.4.4
@FredrikAppelros

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 27, 2013
  1. @FredrikAppelros

    Better handling of the user environment

    FredrikAppelros authored
    A backup of the user environment is now taken during a call to start
    instead of during the launch of the task. This allows for changing the
    user environment when the express server is run using nospawn (as with
    grunt-contrib-watch).
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 10 deletions.
  1. +12 −10 tasks/lib/server.js
View
22 tasks/lib/server.js
@@ -11,16 +11,7 @@
module.exports = function(grunt) {
var done = null;
var server = null; // Store server between live reloads to close/restart express
- var backup = JSON.parse(JSON.stringify(process.env)); // Clone process.env
-
- // For some weird reason, on Windows the process.env stringify produces a "Path"
- // member instead of a "PATH" member, and grunt chokes when it can't find PATH.
- if (!backup.PATH) {
- if (backup.Path) {
- backup.PATH = backup.Path;
- delete backup.Path;
- }
- }
+ var backup = null;
var finished = function() {
if (done) {
@@ -42,6 +33,17 @@ module.exports = function(grunt) {
}
}
+ backup = JSON.parse(JSON.stringify(process.env)); // Clone process.env
+
+ // For some weird reason, on Windows the process.env stringify produces a "Path"
+ // member instead of a "PATH" member, and grunt chokes when it can't find PATH.
+ if (!backup.PATH) {
+ if (backup.Path) {
+ backup.PATH = backup.Path;
+ delete backup.Path;
+ }
+ }
+
grunt.log.writeln('Starting '.cyan + (options.background ? 'background' : 'foreground') + ' Express server');
done = grunt.task.current.async();
Something went wrong with that request. Please try again.