github.com/upcmd/up@v0.8.1-0.20230108151705-ad8b797bf04f/tests/functests/f0172.yml (about)

     1  doc_meta: |
     2    folder: flow-controll
     3    title: final cleanup without resuce
     4    head: |
     5      demo the finally cleanup without a rescue in func step
     6  
     7    sections:
     8      - title: Demo
     9        log: yes
    10  
    11      - title: what will happen if there is no rescue when panic
    12        content: |
    13          This demos that the execution will abort if you do not explicitly resuce the panic
    14  
    15    related:
    16      refs:
    17        - title: shell func
    18          link: ../../quick-start/c0002/
    19        - title: error handling
    20          link: ../../test-debug/error_handling/
    21  
    22  tasks:
    23  
    24    -
    25      name: task
    26      task:
    27  
    28        -
    29          func: cmd
    30          desc: step 1
    31          do:
    32            - name: print
    33              cmd: step 1
    34            - name: panic
    35            - name: print
    36              cmd: extra step ......... it will never reach here
    37          rescue: false
    38          finally: close_file
    39  
    40        -
    41          func: cmd
    42          desc: step 2
    43          do:
    44            - name: print
    45              cmd: step 2
    46  
    47    -
    48      name: close_file
    49      task:
    50        -
    51          func: shell
    52          name: close_file
    53          desc: |
    54            ensure the opened file is closed
    55          do:
    56            - echo "close the file ....."