Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: AndreasMadsen/immortal
base: 508a8fa3d4
...
head fork: AndreasMadsen/immortal
compare: 6caf88b831
  • 3 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
4 README.md
@@ -13,8 +13,8 @@
| | **Mac OS X** | **Linux** | **Windows** |
|-------------:|:-------------------:|:-------------------:|:------------------:|
-| **node 0.7** | testsuite: 183/183 | testsuite: 183/183 | testsuite: 162/183 |
-| **node 0.6** | testsuite: 183/183* | testsuite: 183/183* | testsuite: 162/183 |
+| **node 0.7** | testsuite: 187/187 | testsuite: 187/187 | testsuite: 166/187 |
+| **node 0.6** | testsuite: 187/187* | testsuite: 187/187* | testsuite: 166/187 |
| **node 0.4** | manual confirmed* | manual confirmed* | never |
> Please note that the testsuite in node 0.4 don't work because of the module dependencies
View
5 lib/core/monitor.js
@@ -24,7 +24,10 @@
};
this.strategy = settings.strategy;
this.options = settings.options;
- this.ready = ready;
+
+ this.ready = function () {
+ process.nextTick(ready);
+ };
this.stdout = new streams.RelayStream({ paused: true });
this.stderr = new streams.RelayStream({ paused: true });
View
2  package.json
@@ -1,7 +1,7 @@
{
"name": "immortal",
"description": "Daemon tool made in pure javascript",
- "version": "0.5.0",
+ "version": "0.5.1",
"author": "Andreas Madsen <amwebdk@gmail.com>",
"scripts": {
"test": "vows test/simple/* --spec --isolate",
View
12 test/fixture/sandbox.js
@@ -0,0 +1,12 @@
+
+var common = require('../common.js'),
+ immortal = require(common.immortal);
+
+immortal.start(common.fixture('pingping.js'), {
+ 'strategy': 'development',
+ 'auto': false,
+ 'options': {
+ pidFile: null,
+ output: null
+ }
+}, function () {});
View
76 test/simple/monitor-default-silent.js
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2012 Andreas Madsen
+ * MIT License
+ */
+
+var fs = require('fs'),
+ vows = require('vows'),
+ assert = require('assert'),
+
+ common = require('../common.js'),
+ immortal = require(common.immortal),
+ child_process = require('child_process');
+
+var outputFile = common.temp('output.txt');
+var pidFile = common.temp('daemon.txt');
+
+if (common.existsSync(outputFile)) fs.unlinkSync(outputFile);
+if (common.existsSync(pidFile)) fs.unlinkSync(pidFile);
+
+// used to catch stderr from immortal
+var sandbox = null;
+
+vows.describe('testing default monitor with no output or pidFile').addBatch({
+
+ 'when starting immortal': {
+ topic: function () {
+ var self = this;
+
+ sandbox = child_process.spawn(process.execPath, [ common.fixture('sandbox.js') ]);
+
+ var out = function (chunk) {
+ self.callback(null, chunk);
+ sandbox.stderr.removeListener('data', err);
+ };
+
+ var err = function (chunk) {
+ self.callback(chunk, null);
+ sandbox.stdout.removeListener('data', out);
+ };
+ sandbox.stdout.once('data', out);
+ sandbox.stderr.once('data', err);
+ },
+
+ 'no errors should exist': function (error, chunk) {
+ assert.ifError(error);
+ assert.equal(chunk.toString().indexOf('.'), 0);
+ },
+
+ 'a output file should not exist': function () {
+ assert.isFalse(common.existsSync(outputFile));
+ },
+
+ 'a pid file should not exist': function () {
+ assert.isFalse(common.existsSync(pidFile));
+ },
+ }
+
+}).addBatch({
+
+ 'cleanup: when trying to kill all pids': {
+ topic: function () {
+ var self = this;
+
+ // in theory a SIGPIPE should be propergated though the immortal group
+ // once the parent dies
+ sandbox.kill();
+
+ sandbox.once('exit', this.callback.bind(this, null, sandbox.pid));
+ },
+
+ 'the parent should be dead': function (error, pid) {
+ assert.isFalse(common.isAlive(pid));
+ }
+ }
+
+}).exportTo(module);

No commit comments for this range

Something went wrong with that request. Please try again.