With retry, you can rerun a command until it succeeds.
$ retry 2 wget http://example.com
No dependencies.
$ sudo apt-get install build-essential meson
$ git clone https://github.com/johang/retry.git retry
$ cd retry
$ meson build
$ cd build
$ ninja