Commit 6c69928
committed
fix(cli,browser): robust browser state management and error handling
• Fix CLI silently swallowing launch errors when using --headed/--proxy flags
by checking response.success, not just network errors
• Fix isLaunched() returning true for disconnected browsers by checking
browser.isConnected() and cleaning up stale state
• Add browser.on('disconnected') handler to proactively reset state when
browser crashes or is closed externally
Before: Closing browser window caused "Browser not launched. Call launch first"
error on next command, requiring manual close to recover.
After: Browser state is properly tracked; auto-relaunch works reliably.
Fixes zombie daemon state issue on Windows (and likely other platforms).1 parent 399fd7a commit 6c69928
3 files changed
Lines changed: 82 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
290 | | - | |
291 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
292 | 300 | | |
| 301 | + | |
293 | 302 | | |
294 | 303 | | |
295 | 304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
| 407 | + | |
| 408 | + | |
408 | 409 | | |
409 | 410 | | |
410 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
105 | 139 | | |
106 | 140 | | |
107 | 141 | | |
| |||
694 | 728 | | |
695 | 729 | | |
696 | 730 | | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
697 | 741 | | |
698 | 742 | | |
699 | 743 | | |
700 | 744 | | |
701 | 745 | | |
702 | 746 | | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
703 | 757 | | |
704 | 758 | | |
705 | 759 | | |
| |||
749 | 803 | | |
750 | 804 | | |
751 | 805 | | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
752 | 815 | | |
753 | 816 | | |
754 | 817 | | |
| |||
762 | 825 | | |
763 | 826 | | |
764 | 827 | | |
765 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
766 | 831 | | |
767 | 832 | | |
768 | 833 | | |
| |||
0 commit comments