MCPcopy Create free account
hub / github.com/devcontainers/cli / consume

Function consume

src/spec-common/shellServer.ts:142–167  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

140 consume(str);
141 }
142 function consume(str: string) {
143 // console.log(`consume ${numberOfResults}: '${str}'`);
144 const i = str.indexOf(EOT);
145 if (i !== -1) {
146 const s = str.substr(0, i);
147 strings.push(s);
148 log(s, j, results.length);
149 // console.log(`result ${numberOfResults}: '${strings.join('')}'`);
150 results.push(strings.join(''));
151 strings.length = 0;
152 if (results.length === numberOfResults[j]) {
153 promises[j].resolve(results);
154 j++;
155 results = [];
156 if (j === numberOfResults.length) {
157 stream.off('data', data);
158 }
159 }
160 if (i + 1 < str.length) {
161 consume(str.substr(i + 1));
162 }
163 } else {
164 strings.push(str);
165 log(str, j, results.length);
166 }
167 }
168 stream.on('data', data);
169
170 return promises.map(p => p.promise);

Callers 1

dataFunction · 0.85

Calls 1

logFunction · 0.85

Tested by

no test coverage detected