Giter Club home page Giter Club logo

Comments (2)

yongrenjie avatar yongrenjie commented on August 23, 2024

No, you can't assign a name to the process, but you could use a lock file with the PID of the backend process.

backend = subprocess.Popen(...)
backend.pid
...
print(os.getpid(), file=lock_file)  # backend must delete it after it's done

However, it needs to be compatible with Unix and Windows, which seems to be tricky (especially when the TS py2.7 doesn't have anything outside of stdlib, and sometimes not even stuff in the stdlib).

from nmrpoise.

yongrenjie avatar yongrenjie commented on August 23, 2024

Tested on OS X and Windows

def kill_pid(pid):
    from java.lang.System import getProperty
    # Windows
    if "wind" in getProperty("os.name").lower():
        os.system("taskkill /f /pid {}".format(pid))
    # *nix
    else:
        os.system("kill -9 {}".format(pid))

from nmrpoise.

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.