module.exports = function(grunt) {
	'use strict';

	grunt.registerMultiTask('iisexpress', 'Start an IIS Express process.', function() {
		var _ = grunt.util._;
		var options = this.options({
			cmd: 'c:/program files/iis express/iisexpress.exe',
			killOn: '',
			killOnExit: true,
			open: false,
			openPath: '/',
			openUrl: null,
			verbose: false
		});
		var killed = false;

		// If no entry point defined: run in the current dir
		if (options.config === undefined && options.site === undefined &&
			options.siteid === undefined && options.path === undefined) {
			options.path = '.';
		}

		// Convert options to command line parameter format
		var args = _.map(_.pairs(_.omit(options, ['cmd', 'killOn', 'killOnExit', 'open', 'openPath', 'openUrl', 'verbose'])), function(option) {
			if (option[0] == 'path') {
				option[1] = require('path').resolve(option[1]);
			}
			return '-' + option[0] + ':' + option[1];
		});

		var spawnOptions = {
			detached: true
		};

		// Start up IIS Express with the specified arguments
		var spawn = grunt.util.spawn({
			cmd: options.cmd,
			args: args,
			opts: spawnOptions
		}, function(error, result, code) {
			grunt.event.emit('iisexpress.done', error, result, code);
		});

		if (options.verbose===true) {
			spawn.stdout.on('data', function (data) {
				grunt.log.write(data.toString());
			});
		}

		spawn.stderr.on('data', function (data) {
			grunt.warn(data.toString());
		});

		grunt.log.ok('Started IIS Express.');

		if (options.open===true) {
			if (!options.port && !options.openUrl) {
				grunt.fail.fatal('Must specify port or openUrl when open==true');
			}
			var url = options.openUrl || 'http://localhost:' + options.port + options.openPath;
			grunt.log.writeln('opening', url);

			var done = this.async();
			require('open')(url, function() {
				done();
			});
		}

		if (options.killOn !== '') {
			// Register event listener to use to kill spawned process
			grunt.event.on(options.killOn, kill);
		}

		if (options.killOnExit===true) {
			var readLine = require('readline');

			var rl = readLine.createInterface({
				input: process.stdin,
				output: process.stdout
			});

			rl.on('SIGINT', function () {
				process.emit('SIGINT');
			});

			process.on('exit', kill);
			process.on('SIGINT', killAndExit);
			process.on('SIGHUP', killAndExit);
			process.on('SIGBREAK', killAndExit);
		}

		function kill() {
			if (killed) {
				return;
			}
			if (options.verbose) {
				grunt.log.write('Stopping IIS Express..');
			}
			spawn.kill();
			killed = true;
			if (options.verbose) {
				grunt.log.write(' ');
				grunt.log.ok();
			}
		}

		function killAndExit() {
			kill();
			process.exit();
		}
	});
};

@@ -239,16 +239,37 @@
 s.exe',%0A
+%09%09%09keepalive: false,%0A
 %09%09%09killO
@@ -395,16 +395,153 @@
 false;%0A%0A
+%09%09// keepalive can be an option or a flag (eg 'iisexpress:dist:keepalive')%0A%09%09var keepAlive = this.flags.keepalive %7C%7C options.keepalive;%0A%0A
 %09%09// If 
@@ -852,16 +852,29 @@
  %5B'cmd',
+ 'keepalive',
  'killOn
@@ -1989,20 +1989,254 @@
 %09%09%09%09
-done();%0A%09%09%09%7D
+if (!keepAlive) %7B%0A%09%09%09%09%09done();%0A%09%09%09%09%7D else %7B%0A%09%09%09%09%09grunt.log.writeln('Waiting forever...');%0A%09%09%09%09%7D%0A%09%09%09%7D);%0A%09%09%7D%0A%0A%09%09if (keepAlive && !done) %7B%0A%09%09%09var waitForever = this.async(); // grunt will not finish the task%0A%09%09%09grunt.log.writeln('Waiting forever...'
 );%0A%09

Add keepalive option/flag (like in grunt-contrib-connect)