On Sat, Sep 7, 2019 at 9:08 AM Marcin Zajączkowski <msz...@wp.pl> wrote:

> Sure. I want to be able to call other command on the command failure:
>
> > my_command || call_error_handler
>
> where the error handler could be curl to https://healthchecks.io/


The following script produces this result:









*returning status 0status is 0returning status 1handling status 1status is
1returning status 33handling status 33status is 33*


function my_command
    echo returning status $argv[1]
    return $argv[1]
end

function call_error_handler
    set -l saved_status $status
    echo handling status $saved_status
    return $saved_status
end

my_command 0; or call_error_handler
echo status is $status
my_command 1; or call_error_handler
echo status is $status
my_command 33; or call_error_handler
echo status is $status
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to