Giter VIP home page Giter VIP logo

Comments (5)

tarekziade avatar tarekziade commented on August 24, 2024

I don't think that's very robust because you can't guess everything

instead, what about a dry run mode ? where we run everything for a few seconds and stop everything, just to make sure everything is sane.

from circus.

benoitc avatar benoitc commented on August 24, 2024

this is the case actually, the OSError is catched and stop after the retry limit (by default 5) .

I was thinking to use something like:

def check_cmd(cmd, env=None):

    os_env = os.environ
    if isinstance(env, dict):
        os_env.update(env)

    cmd_path = cmd.split(None)[0]

    if os.path.isabs(cmd_path) and os.path.exists(cmd_path):
        return True 


    if os.path.dirname(path):
        path = os.path.normpath(os.path.realpath(cmd_path))
        if os.path.exists(path):
            return True

    env_path = os_env.get('PATH')
    if not env_path:
        # we can't do anything here. 
        return True

    for path in paths.split(os.pathsep):
        filename = os.path.join(path, cmd_path)
        if os.access(filename, os.X_OK):
            return True
   return False

which does that. The idea is to return an error first instead of creating a show. Not sure if it's really important there since we can update dynamically the command or remove a show though.

from circus.

tarekziade avatar tarekziade commented on August 24, 2024

mmm... knowing that the file exist don't make it a valid program -- I am not sure this is very useful since the real validation is actually running the program with the configured options.

from circus.

benoitc avatar benoitc commented on August 24, 2024

the idea is to test common mistakes like forgetting a / at startup or giving wrong path). We could also test the executable bit eventually. With that we could remove extra time check due to retries.

from circus.

benoitc avatar benoitc commented on August 24, 2024

it's already handled somehow by Popen. Let's close it for now.

from circus.

Related Issues (20)

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.