mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
675 B
35 lines
675 B
15 years ago
|
require("../common");
|
||
16 years ago
|
|
||
15 years ago
|
var spawn = require('child_process').spawn;
|
||
|
|
||
16 years ago
|
var pwd_called = false;
|
||
|
|
||
|
function pwd (callback) {
|
||
|
var output = "";
|
||
15 years ago
|
var child = spawn("pwd");
|
||
|
|
||
|
child.stdout.setEncoding('utf8');
|
||
|
child.stdout.addListener("data", function (s) {
|
||
15 years ago
|
puts("stdout: " + JSON.stringify(s));
|
||
15 years ago
|
output += s;
|
||
16 years ago
|
});
|
||
15 years ago
|
|
||
15 years ago
|
child.addListener("exit", function (c) {
|
||
15 years ago
|
puts("exit: " + c);
|
||
15 years ago
|
assert.equal(0, c);
|
||
16 years ago
|
callback(output);
|
||
|
pwd_called = true;
|
||
16 years ago
|
});
|
||
16 years ago
|
}
|
||
|
|
||
|
|
||
15 years ago
|
pwd(function (result) {
|
||
15 years ago
|
p(result);
|
||
15 years ago
|
assert.equal(true, result.length > 1);
|
||
|
assert.equal("\n", result[result.length-1]);
|
||
15 years ago
|
});
|
||
16 years ago
|
|
||
15 years ago
|
process.addListener("exit", function () {
|
||
15 years ago
|
assert.equal(true, pwd_called);
|
||
15 years ago
|
});
|