Sha256: 8c02b51d35ee54b1f47047bb9f4d5cae6a0de511ca20cfc779bbcb4aca6d091d

Contents?: true

Size: 728 Bytes

Versions: 3

Compression:

Stored size: 728 Bytes

Contents

common = require("../common");
assert = common.assert

var spawn = require('child_process').spawn;

var pwd_called = false;

function pwd (callback) {
  var output = "";
  var child = spawn("pwd");

  child.stdout.setEncoding('utf8');
  child.stdout.addListener("data", function (s) {
    console.log("stdout: " + JSON.stringify(s));
    output += s;
  });

  child.addListener("exit", function (c) {
    console.log("exit: " + c);
    assert.equal(0, c);
    callback(output);
    pwd_called = true;
  });
}


pwd(function (result) {
  common.p(result);
  assert.equal(true, result.length > 1);
  assert.equal("\n", result[result.length-1]);
});

process.addListener("exit", function () {
  assert.equal(true, pwd_called);
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rednode-0.1.2 ext/node/test/simple/test-child-process-buffering.js
rednode-0.1.1 ext/node/test/simple/test-child-process-buffering.js
rednode-0.1.0 ext/node/test/simple/test-child-process-buffering.js