var sys = require('sys');
var events = require('events');
var child_process = require('child_process');

//var helpers = require('../helpers.js');

// watch object
// Not exported because this shouldn't be called directly.
var watch = function (func) {

    func.call(this);

    this.__defineGetter__('pid', function () {
        if (typeof this.child === 'undefined') {
            return null;
        } else {
            return this.child.pid;
        }
    });

    this.__defineGetter__('running', function () {
        if (typeof this.pid !== 'undefined' && this.pid !== null) {
            return true;
        } else {
            return false;
        }
    });
};

sys.inherits(watch, events.EventEmitter);

watch.prototype.start = function () {
    if (this.running) return false;

    var self = this;

    this.emit('start');

    this.child = helpers.exec(this.startCommand, function (err, stdout, stderr) {
        self.emit('finish', err, stdout, stderr);
    });

    this.stdin = this.child.stdin;
    this.stdout = this.child.stdout;
    this.stderr = this.child.stderr;

    this.stdout.on('data', function (data) {
        self.emit('data', data);
    });

    this.stderr.on('data', function (data) {
        self.emit('err', data);
    });

    this.emit('started');

    this.child.on('exit', function (code, signal) {
        self.emit('exit', code, signal);
    });
};

// stop function for a single watch instance
watch.prototype.stop = function () {
    return this.child.kill();
};

// This function creates a new watch instance,
// then push it to the watchList.
exports.newWatch = function (func) {
    var id = this.watchList.push( new watch(func) ) - 1;
    return this.watchList[id];
};

@@ -265,32 +265,86 @@
 all(this);%0A%0A
-    this
+%7D;%0A%0Asys.inherits(watch, events.EventEmitter);%0A%0Awatch.prototype
 .__defineGet
@@ -366,36 +366,32 @@
 nction () %7B%0A    
-   
- 
 if (typeof this.
@@ -419,28 +419,24 @@
 ) %7B%0A        
-    
 return null;
@@ -436,28 +436,24 @@
 n null;%0A    
- 
-   
 %7D else %7B%0A   
@@ -449,36 +449,32 @@
  else %7B%0A        
-  
-  
 return this.chil
@@ -488,31 +488,30 @@
     
-    %7D%0A    %7D);%0A%0A    this
+%7D%0A%7D);%0A%0Awatch.prototype
 .__d
@@ -545,28 +545,24 @@
 nction () %7B%0A
-    
     if (type
@@ -617,28 +617,24 @@
 ) %7B%0A        
-    
 return true;
@@ -638,20 +638,16 @@
 ue;%0A    
-  
-  
 %7D else %7B
@@ -651,28 +651,24 @@
 e %7B%0A        
-   
- 
 return false
@@ -677,65 +677,11 @@
     
-    %7D%0A    %7D);%0A%7D;%0A%0Asys.inherits(watch, events.EventEmitter
+%7D%0A%7D
 );%0A%0A

Define watch.pid and watch.running getters on watch.prototype