(stdout)
| 30 | return /\s/.test(text) ? `"${text.replace(/"/g, '\\"')}"` : text; |
| 31 | } |
| 32 | |
| 33 | function display(command, args) { |
| 34 | return [command, ...args].map(q).join(' '); |
| 35 | } |
| 36 | |
| 37 | function parseJson(stdout) { |
| 38 | const text = String(stdout || '').trim(); |
| 39 | if (!text.startsWith('{') && !text.startsWith('[')) return null; |
| 40 | try { |
| 41 | return JSON.parse(text); |
| 42 | } catch { |
| 43 | return null; |