MCPcopy Create free account
hub / github.com/play-co/devkit / getClient

Function getClient

src/jvmtools/tealeaf-build-tools/javaBridge.js:148–176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146var ARGS = ['-jar', path.join(__dirname, 'tealeaf-build-tools.jar')];
147
148function 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
178function connectClient (hostname, port) {
179

Callers 1

javaBridge.jsFile · 0.85

Calls 1

connectClientFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…