Git Product home page Git Product logo

Comments (11)

laino avatar laino commented on May 28, 2024

There is no windows support at the moment. None planned either.

from final-pm.

laino avatar laino commented on May 28, 2024

Though that went surprisingly far. Let me check how much would actually need to be done to support Windows.

from final-pm.

laino avatar laino commented on May 28, 2024

Pretty much all that is necessary to get it working is not using unix domain sockets and fixing the ENOENT when starting the daemon.

All tests, besides (for obvious reasons) the unix domain socket test pass on Windows as well.

from final-pm.

laino avatar laino commented on May 28, 2024

6a56152

from final-pm.

stanleyxu2005 avatar stanleyxu2005 commented on May 28, 2024

Thank you for your quick update. I can finally run it on windows, although I still need to comment out the examples related things in cli-args.js

The most important thing of seeking a PM2 alternative is that, all forked processes cannot trigger process.on('exit'), process.on('SIGINT') anymore. I tried with final-pm on Windows, the result is the same. These events have never been triggered.

from final-pm.

laino avatar laino commented on May 28, 2024

That's a problem with Windows in general. Not specific to final-pm, PM2, or even node.

https://nodejs.org/api/process.html#process_signal_events

Note: Windows does not support sending signals, but Node.js offers some emulation with process.kill(), and subprocess.kill(). Sending signal 0 can be used to test for the existence of a process. Sending SIGINT, SIGTERM, and SIGKILL cause the unconditional termination of the target process.

Maybe I'll add an option to send a message via IPC instead of a signal. But at the end of the day I can't recommend using a windows host for (node.js) applications in production. That is pain without end.

You might be fine just developing on Windows, but even then you'll encounter modules that have lackluster support for Windows all the time. Case in point: The ws[1] module's client doesn't appear to
have support for named pipes on windows, else I'd have implemented that as a replacement for unix domain sockets when I added Windows support.

  1. https://github.com/websockets/ws

from final-pm.

laino avatar laino commented on May 28, 2024

@stanleyxu2005 What do you mean you have to comment the examples related things in cli-args.js?

I just noticed they're somehow garbled in windows power shell, but nothing really breaking.

from final-pm.

stanleyxu2005 avatar stanleyxu2005 commented on May 28, 2024

The git repo contains a dir "examples" but when you publish the code to npm, I believe this dir is not shipped, so that when I start final-pm, it cannot find some files from this dir.

exports.example = [
    {
        header: "Example",
    },
    {
        content: {
            options: {
                noTrim: true
            },
            data: [
                { col: "[underline]{Example Config}" },
                { col: "[italic]{final-pm --config sample-config.js start myApp}\n" }
            ].concat(fileToColumns('examples/sample-config.js'))
        }
    },

It's very easy to reproduce.

mkdir test1
cd test1
npm install final-pm
node_modules\.bin\final-pm start all

from final-pm.

stanleyxu2005 avatar stanleyxu2005 commented on May 28, 2024

@laino Thank you for the clarification of signal capture things in Windows. I still hope to find some way to simulate sending CTRL+C to stdin. In short, I create master.js and child.js, and then when I press CTRL+C to stop master.js, child.js is able to trap readline close event. Here is the full version of the story Unitech/pm2#3467

Node under Linux works quite smooth. But for Windows users and development, it has a lot of pain. I need to understand whether this is a Node issue or common problem. If Python does not have the problem, I might need to re-write my whole piece of code in Python or other languages.

from final-pm.

laino avatar laino commented on May 28, 2024

I'm unsure, but this may help.

As for the bug with the examples, I can't seem to be able to reproduce it.

from final-pm.

stanleyxu2005 avatar stanleyxu2005 commented on May 28, 2024

Oh. Yeah, I expect to have a tiny exe to send ctrl+c to any application, or a node module binds with similar c code. For example there is a deasync node module can force nodejs to run code in sync-manner.

Regarding the bug with the examples, maybe it is because I actually ran yarn add final-pm --production and I have a .yarnclean at my project directory, which might remove examples dir by default. Do you think cli-args.js contains export.examples is good practice?

from final-pm.

Related Issues (7)

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.