src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/eval/builtin_fn_cmd_test.elvts (about)

     1  ////////
     2  # exit #
     3  ////////
     4  
     5  ## default code is 0 ##
     6  //check-exit-code-afterwards 0
     7  ~> exit
     8  
     9  ## explicit code ##
    10  //check-exit-code-afterwards 1
    11  ~> exit 1
    12  
    13  ## runs pre-exit hooks ##
    14  //check-pre-exit-hook-afterwards
    15  ~> exit
    16  
    17  ## wrong arity ##
    18  ~> exit 1 2
    19  Exception: arity mismatch: arguments must be 0 to 1 values, but is 2 values
    20    [tty]:1:1-8: exit 1 2
    21  
    22  /////////////////////
    23  # external commands #
    24  /////////////////////
    25  
    26  //only-on unix
    27  //set-env PATH /bin
    28  
    29  ~> has-external sh
    30  ▶ $true
    31  ~> search-external sh
    32  ▶ /bin/sh
    33  ~> (external sh) -c 'echo external-sh'
    34  external-sh
    35  ~> has-external random-invalid-command
    36  ▶ $false
    37  ~> search-external random-invalid-command
    38  Exception: exec: "random-invalid-command": executable file not found in $PATH
    39    [tty]:1:1-38: search-external random-invalid-command