
    cH                     L    d Z ddlmZmZ ddlZddlmc mc mZ ddl	m
Z
 d ZdS )zHandles uncaught exceptions.    )absolute_importprint_functionN)slugifyc                    t          |          }	  |             S # t          $ r" t          d|z  t          j                   Y dS t
          $ r t          j                    \  }}}	 ddl}ddl}ddl	}	ddl
}
t          d|z  t          j                   t          d|j        dt          |          d	t          j                   t          j                     |j                                                                        }d
|d|d}|	                    |dd          5 j        }fd} |d|d|            |d            |dt          j        z              |d            ||                    |                      |d            |d                    |
                    |||                               ddd           n# 1 swxY w Y   rt          d|z  t          j                   nt          d|z  t          j                   n# t
          $ r |w xY wY dS w xY w)ah  Invoke main entry point, handling uncaught exceptions.

    Args:
        main_func (function): a main()-style function returning an exit status
        program_name (str): name of the app
        details_dict (dict): dictionary of stuff to include in the bug report file

    Returns:
        an exit status code from main_func or 1 on uncaught exception
    z%s was interrupted.file   r   Nz6An unexpected error occurred, most likely a bug in %s.z    (The error was: z: )bug_details__z.txtF)prefixsuffixdeletec                                          |                     d                                          d                    d                     rt          | t          j                   d S d S )Nzutf-8
r   )writeencodeprintsysstderr)sbugfileoutput_to_consoles    Ilib/python3.11/site-packages/anaconda_project/internal/cli/bug_handler.pyoutputzhandle_bugs.<locals>.output:   sl    MM!((7"3"3444MM$++g"6"6777( 2acj1111112 2    zBug details for z
 error on  zsys.argv: %rr   z#Above details were also saved to %sz(Details about the error were saved to %s)r   KeyboardInterruptr   r   r   	Exceptionexc_infodatetimepprinttempfile	traceback__name__strconsole_utilsstdin_is_interactivedatetoday	isoformatNamedTemporaryFilenameargvpformatjoinformat_exception)	main_funcprogram_namedetails_dictslugified_program_nameexception_typeexception_valueexception_tracer!   r"   r#   r$   whenr   report_namer   r   r   s                  @@r   handle_bugsr;      s    %\225y{{    	#l2DDDDqq - - -=@\^^:/'	"OOOMMMOOOJ\Y`c`jkkkkE>3J3J3JCP_L`L`L`L`ahkhrssss %2$F$H$H H=&&((2244DD-C-C-CTTTJF,,F6RW,XX p\c%l2 2 2 2 2 2 <<<NOOOr


~0111r


v~~l33444r


tyy!;!;NO]l!m!mnnooop p p p p p p p p p p p p p p" ! a;kIPSPZ[[[[[@;NUXU_```` 	" 	" 	" "!		" qq[-sT   	 (I !I *CH,,B)G!H,!G%	%H,(G%	)AH,+I ,H99I ?I )__doc__
__future__r   r   r   +anaconda_project.internal.cli.console_utilsinternalclir'   !anaconda_project.internal.slugifyr   r;    r   r   <module>rC      s    # " 6 6 6 6 6 6 6 6 



 C C C C C C C C C C C C 5 5 5 5 5 5B B B B Br   