(raw: string)
| 9 | /** Split the raw arguments field into tokens, honoring double-quoted groups so |
| 10 | * an argument with spaces stays intact. */ |
| 11 | export function parseStdioArgs(raw: string): string[] { |
| 12 | if (!raw.trim()) return []; |
| 13 | const args: string[] = []; |
| 14 | const regex = /[^\s"]+|"([^"]*)"/g; |
| 15 | let match; |
| 16 | while ((match = regex.exec(raw)) !== null) { |
| 17 | args.push(match[1] ?? match[0]); |
| 18 | } |
| 19 | return args; |
| 20 | } |
| 21 | |
| 22 | /** Render stored arguments back into the single-line field, re-quoting any |
| 23 | * token that contains whitespace so `parseStdioArgs` recovers it. */ |
no test coverage detected