| 465 | } |
| 466 | |
| 467 | function gitUserName(projectRoot: string): string | null { |
| 468 | try { |
| 469 | const out = execFileSync('git', ['config', 'user.name'], { |
| 470 | cwd: projectRoot, |
| 471 | encoding: 'utf-8', |
| 472 | timeout: 2_000, |
| 473 | stdio: ['ignore', 'pipe', 'ignore'], |
| 474 | windowsHide: true, |
| 475 | }); |
| 476 | const name = out.trim(); |
| 477 | return name === '' ? null : name.slice(0, 120); |
| 478 | } catch { |
| 479 | // No git, no config, not a repository — all ordinary. Fall through. |
| 480 | return null; |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | function osUserName(): string | null { |
| 485 | try { |