Commit f62de11
fix(agent): remove debug code and refactor detached process handling (#1568)
Removes leftover debug code from `prepare_process()` that was
inadvertently hiding console windows for all processes without IO
redirection, not just detached processes.
The code set `STARTF_USESHOWWINDOW` and `SW_HIDE` on the startup info,
affecting behavioral correctness for existing non-detached process
execution.
Additionally, refactors duplicated detached mode handling logic into a
shared helper function to improve code maintainability.
**Changes:**
- Removed `startup_info.dwFlags |= STARTF_USESHOWWINDOW`
- Removed `startup_info.wShowWindow = SW_HIDE` assignment
- Removed explanatory comment about console window visibility control
- Added `send_detached_process_success()` helper method to
`MessageProcessor`
- Replaced 4 duplicate code blocks in `exec_process`, `exec_batch`,
`exec_winps`, and `exec_pwsh` methods
The imports remain as they're still correctly used in
`prepare_process_with_io_redirection()`.
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/Devolutions/devolutions-gateway/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: pacmancoder <3994505+pacmancoder@users.noreply.github.com>1 parent 31fcaf5 commit f62de11
2 files changed
+46
-83
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 124 | + | |
128 | 125 | | |
129 | 126 | | |
130 | 127 | | |
| |||
136 | 133 | | |
137 | 134 | | |
138 | 135 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
143 | 139 | | |
144 | 140 | | |
145 | 141 | | |
| |||
158 | 154 | | |
159 | 155 | | |
160 | 156 | | |
161 | | - | |
162 | | - | |
| 157 | + | |
163 | 158 | | |
164 | 159 | | |
165 | 160 | | |
| |||
283 | 278 | | |
284 | 279 | | |
285 | 280 | | |
286 | | - | |
287 | | - | |
| 281 | + | |
288 | 282 | | |
289 | 283 | | |
290 | 284 | | |
| |||
375 | 369 | | |
376 | 370 | | |
377 | 371 | | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
385 | 378 | | |
386 | 379 | | |
387 | 380 | | |
388 | 381 | | |
389 | 382 | | |
390 | 383 | | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
398 | 390 | | |
399 | 391 | | |
400 | 392 | | |
| |||
438 | 430 | | |
439 | 431 | | |
440 | 432 | | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
448 | 439 | | |
449 | 440 | | |
450 | 441 | | |
451 | 442 | | |
452 | 443 | | |
453 | 444 | | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
461 | 451 | | |
462 | 452 | | |
463 | 453 | | |
| |||
592 | 582 | | |
593 | 583 | | |
594 | 584 | | |
595 | | - | |
| 585 | + | |
| 586 | + | |
596 | 587 | | |
597 | 588 | | |
598 | 589 | | |
| |||
654 | 645 | | |
655 | 646 | | |
656 | 647 | | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | 648 | | |
661 | 649 | | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | 650 | | |
666 | 651 | | |
667 | 652 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
319 | 329 | | |
320 | 330 | | |
321 | 331 | | |
| |||
570 | 580 | | |
571 | 581 | | |
572 | 582 | | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
| 583 | + | |
582 | 584 | | |
583 | 585 | | |
584 | 586 | | |
| |||
612 | 614 | | |
613 | 615 | | |
614 | 616 | | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
| 617 | + | |
624 | 618 | | |
625 | 619 | | |
626 | 620 | | |
| |||
671 | 665 | | |
672 | 666 | | |
673 | 667 | | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
| 668 | + | |
683 | 669 | | |
684 | 670 | | |
685 | 671 | | |
| |||
732 | 718 | | |
733 | 719 | | |
734 | 720 | | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
| 721 | + | |
744 | 722 | | |
745 | 723 | | |
746 | 724 | | |
| |||
0 commit comments