| 1170 | } |
| 1171 | |
| 1172 | function runRaw (dir, args, callback) { |
| 1173 | var argv = [BIN_PATH].concat(args) |
| 1174 | var binp = process.argv[0] |
| 1175 | var stderr = '' |
| 1176 | var stdout = '' |
| 1177 | |
| 1178 | var child = spawn(binp, argv, { |
| 1179 | cwd: dir |
| 1180 | }) |
| 1181 | |
| 1182 | child.stdout.setEncoding('utf8') |
| 1183 | child.stdout.on('data', function ondata (str) { |
| 1184 | stdout += str |
| 1185 | }) |
| 1186 | child.stderr.setEncoding('utf8') |
| 1187 | child.stderr.on('data', function ondata (str) { |
| 1188 | stderr += str |
| 1189 | }) |
| 1190 | |
| 1191 | child.on('close', onclose) |
| 1192 | child.on('error', callback) |
| 1193 | |
| 1194 | function onclose (code) { |
| 1195 | callback(null, code, stdout, stderr) |
| 1196 | } |
| 1197 | } |
| 1198 | |
| 1199 | function setupTestEnvironment (name) { |
| 1200 | var ctx = {} |