()
| 146 | var ARGS = ['-jar', path.join(__dirname, 'tealeaf-build-tools.jar')]; |
| 147 | |
| 148 | function getClient () { |
| 149 | if (!_javaProcess) { |
| 150 | var proc = _javaProcess = spawn(CMD, ARGS); |
| 151 | proc.stdout.once('data', function (data) { |
| 152 | // Read hostname:port |
| 153 | var parts = String(data).trim().split(':'); |
| 154 | var ip = parts[0]; |
| 155 | //check if the ip is returned as all zeros |
| 156 | if (parts[0] == '0.0.0.0') { |
| 157 | //just use localhost instead since connecting to 0.0.0.0 |
| 158 | //does not work on windows |
| 159 | ip = 'localhost'; |
| 160 | } |
| 161 | connectClient(ip, parts[1]); |
| 162 | }); |
| 163 | proc.stderr.on('data', function (data) { |
| 164 | // process.stderr.write('TealeafBuildTools: ' + data); |
| 165 | }); |
| 166 | proc.on('exit', function (code) { |
| 167 | if (code !== 0 && _javaProcess) { |
| 168 | logger.error('exited with code ' + code); |
| 169 | } |
| 170 | proc.stdin.end(); |
| 171 | _javaProcess = null; |
| 172 | }); |
| 173 | } |
| 174 | |
| 175 | return _withClient; |
| 176 | } |
| 177 | |
| 178 | function connectClient (hostname, port) { |
| 179 |
no test coverage detected
searching dependent graphs…