Giter Club home page Giter Club logo

immo's Introduction

immo

Runs a command until it succeeds.

Description

immo runs the specified command and re-runs it if it has failed (exit code != 0). If the command suceeds or the number of attempts reached the limit, immo exits with stdout, stderr and the exit code being those of the command.

Usage

immo [-C config.json] [-n count] [-t timeout] [-p pattern] [--] command args...

Options:

--config,   -C <file>     Specify configuration file (see below)
--attempts, -n <count>    Maximum number of attempts (default: 5)
--timeout,  -t <seconds>  Timeout for each execution in seconds (default: no timeout)
--pattern,  -p <pattern>  Retry execution only if one the regexp patterns was met, can be specified multiple times
--quiet,    -q            Do not show the outputs of failed executions

Configuration

module.exports = {
  // Corresponds to --pattern
  outputPatterns: [
    /cannot open port: \d+/
  ],

  // Corresponds to --timeout
  timeoutSeconds: 2.5,

  // Corresponds to --attempts
  maxAttempts: 5,

  // Corresponds to --quiet
  quiet: false
};

Also consult the config.sample.js.

Example

% immo -- node -e 'var dice = Math.floor(Math.random() * 6)+1; console.log("dice:", dice); if (dice !== 6) throw "boo!"'
# [0/5] --> run ["node","-e","var dice = Math.floor(Math.random() * 6)+1; console.log(\"dice:\", dice); if (dice !== 6) throw \"boo!\""]
# [1/5] --> exited with code 1
# [1/5] OUT dice: 3
# [1/5] ERR
# [1/5] ERR [eval]:1
# [1/5] ERR r(Math.random() * 6)+1; console.log("dice:", dice); if (dice !== 6) throw "boo
# [1/5] ERR                                                                     ^
# [1/5] ERR boo!
# [2/5] --> exited with code 1
# [2/5] OUT dice: 2
# [2/5] ERR
# [2/5] ERR [eval]:1
# [2/5] ERR r(Math.random() * 6)+1; console.log("dice:", dice); if (dice !== 6) throw "boo
# [2/5] ERR                                                                     ^
# [2/5] ERR boo!
# [3/5] --> command succeeded
dice: 6
% echo $?
0

Author

motemen [email protected]

immo's People

Contributors

motemen avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.