also looking at this
feat: add shared-clock scoped vehicle simulation sessions
#98
42 files
+2764
-127
| @@ -5,6 +5,7 @@ export interface BoundedProcessOptions { | ||
| 5 | 5 | stdoutBytes: number |
| 6 | 6 | stderrBytes: number |
| 7 | 7 | label: string |
| 8 | strictUtf8?: boolean | |
| 8 | 9 | } |
| 9 | 10 | |
| 10 | 11 | export interface BoundedProcessResult { |
| @@ -46,7 +47,7 @@ export async function runBoundedProcess(command: string[], options: BoundedProce | ||
| 46 | 47 | try { |
| 47 | 48 | while (true) { |
| 48 | 49 | const { done, value } = await reader.read() |
| 49 | if (done) return Buffer.concat(chunks, bytes).toString('utf8') | |
| 50 | if (done) return new TextDecoder('utf-8', { fatal: options.strictUtf8 === true, ignoreBOM: true }).decode(Buffer.concat(chunks, bytes)) | |
| 50 | 51 | if (value.byteLength > limit - bytes) { |
| 51 | 52 | const error = new Error(`${options.label} ${label} exceeds byte limit`) |
| 52 | 53 | stop(error, `${label} exceeds byte limit`) |