Giter VIP home page Giter VIP logo

Comments (3)

mattijs avatar mattijs commented on May 20, 2024

Thanks for your input. I agree on the buffering of output, this can be dangerous. I'll change the code to not buffer the output and only pass it to the output handlers.

On output handlers, these are already available in master (have not released a new version yet) so adding events will not add any functionality, you can already capture and parse the output by assigning output handlers through the output method. I'll add an example to the repository to demonstrate this.

I want to keep parsing the rsync command's output out of this library because the output is heavily dependent on how the command was build and with what options. It is not possible to set up output parsing for every possible combination of parameters so I want to leave that in the hands of the programmer who configured the command. The output handlers can be used to get the output and parse it for the configured command. Sending events should also be done from the implementing code if this is desired.

I'm still working out if exec is better than spawn, I think you want the sub-process to keep running when the main process is killed to prevent partially transferred file lists.

from node-rsync.

psi-4ward avatar psi-4ward commented on May 20, 2024

Okay the output handlers are fine for me.
But working with exec makes it very difficult to send SIGTERM or other kill-signals to rsync. NodeJS kills only the subshell (sh) and rsyn runs furthermore. AND exec everytime buffers all std(in|out)!
So i think using spwan is the only way to go. To be correct i think its good and necessarry to kill rsync if the main-process dies!

from node-rsync.

mattijs avatar mattijs commented on May 20, 2024

I can agree on the fact that spawn would be better because of the buffering, but the argument that exec makes sending SIGTERM signals to the process harder is kind of weak. It does not make it harder, it just makes it different. You can still use standard tools (like kill on Unix) to end the process, it's just not same as pressing CTRL-c to end the parent node process.

I will change the default behaviour to spawn because the buffer point is valid and it's important to have solid default behaviour for the library. I do value the option to detach the process so it will keep running if the parent dies. I'll figure out another way to do this, probably with something like an executeDetached method.

I'll try to update the code this week to use spawn and hopefully release a new version. Thanks for your feedback.

cheers

from node-rsync.

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.