2009-11-01 03:06:46 +08:00
|
|
|
var path = require("path");
|
|
|
|
libDir = path.join(path.dirname(__filename), "../lib");
|
2009-10-26 05:51:10 +08:00
|
|
|
require.paths.unshift(libDir);
|
2009-11-01 03:06:46 +08:00
|
|
|
process.mixin(require("sys"));
|
2009-07-13 18:48:59 +08:00
|
|
|
function next (i) {
|
|
|
|
if (i <= 0) return;
|
|
|
|
|
2009-10-30 06:34:10 +08:00
|
|
|
var child = process.createChildProcess("echo", ["hello"]);
|
2009-07-13 18:48:59 +08:00
|
|
|
|
2009-08-27 04:11:51 +08:00
|
|
|
child.addListener("output", function (chunk) {
|
2009-07-13 18:48:59 +08:00
|
|
|
if (chunk) print(chunk);
|
|
|
|
});
|
|
|
|
|
2009-08-27 04:11:51 +08:00
|
|
|
child.addListener("exit", function (code) {
|
2009-09-28 22:50:19 +08:00
|
|
|
if (code != 0) process.exit(-1);
|
2009-07-13 18:48:59 +08:00
|
|
|
next(i - 1);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
next(500);
|