Show More
@@ -642,45 +642,37 b' def run(cmd, wd, options, replacements):' | |||||
642 | ret = proc.wait() |
|
642 | ret = proc.wait() | |
643 | return (ret, None) |
|
643 | return (ret, None) | |
644 |
|
644 | |||
645 | if os.name == 'nt' or sys.platform.startswith('java'): |
|
645 | proc = Popen4(cmd, wd, options.timeout) | |
646 | tochild, fromchild = os.popen4(cmd) |
|
646 | def cleanup(): | |
647 | tochild.close() |
|
647 | try: | |
648 | output = fromchild.read() |
|
648 | proc.terminate() | |
649 | ret = fromchild.close() |
|
649 | except OSError: | |
650 | if ret is None: |
|
650 | pass | |
651 |
|
|
651 | ret = proc.wait() | |
652 | else: |
|
652 | if ret == 0: | |
653 | proc = Popen4(cmd, wd, options.timeout) |
|
653 | ret = signal.SIGTERM << 8 | |
654 |
|
|
654 | killdaemons() | |
655 | try: |
|
655 | return ret | |
656 | proc.terminate() |
|
656 | ||
657 | except OSError: |
|
657 | output = '' | |
658 | pass |
|
658 | proc.tochild.close() | |
659 | ret = proc.wait() |
|
|||
660 | if ret == 0: |
|
|||
661 | ret = signal.SIGTERM << 8 |
|
|||
662 | killdaemons() |
|
|||
663 | return ret |
|
|||
664 |
|
659 | |||
665 | output = '' |
|
660 | try: | |
666 |
proc. |
|
661 | output = proc.fromchild.read() | |
667 |
|
662 | except KeyboardInterrupt: | ||
668 | try: |
|
663 | vlog('# Handling keyboard interrupt') | |
669 | output = proc.fromchild.read() |
|
664 | cleanup() | |
670 | except KeyboardInterrupt: |
|
665 | raise | |
671 | vlog('# Handling keyboard interrupt') |
|
|||
672 | cleanup() |
|
|||
673 | raise |
|
|||
674 |
|
666 | |||
675 |
|
|
667 | ret = proc.wait() | |
676 |
|
|
668 | if wifexited(ret): | |
677 |
|
|
669 | ret = os.WEXITSTATUS(ret) | |
678 |
|
670 | |||
679 |
|
|
671 | if proc.timeout: | |
680 |
|
|
672 | ret = 'timeout' | |
681 |
|
673 | |||
682 |
|
|
674 | if ret: | |
683 |
|
|
675 | killdaemons() | |
684 |
|
676 | |||
685 | for s, r in replacements: |
|
677 | for s, r in replacements: | |
686 | output = re.sub(s, r, output) |
|
678 | output = re.sub(s, r, output) |
General Comments 0
You need to be logged in to leave comments.
Login now