Coder Social home page Coder Social logo

Support interruptions about filewatcher HOT 7 CLOSED

filewatcher avatar filewatcher commented on September 26, 2024
Support interruptions

from filewatcher.

Comments (7)

thomasfl avatar thomasfl commented on September 26, 2024

That's a great idea. It would be natural to name such an option -r/--restart

This could be used to send a kill 9/SIGHUP to a webserver and then start the webserver again every time some change in the filesystem happens.

 $ filewatcher "**/*.js" --restart "ruby sinatra"

from filewatcher.

thomasfl avatar thomasfl commented on September 26, 2024

@acadet I have released a new version of filewatcher with new --dontwait and --restart options. Now you should be able to use it to start a webserver and have it restarted on file updates.

$ filewatcher --restart --dontwait "**/*.html" "python -m SimpleHTTPServer"

Please let me know if you have any problems.

BTW! I think this is a real cool functionality.

from filewatcher.

thomasfl avatar thomasfl commented on September 26, 2024

@acadet @flbulgarelli @oldpatricka @noplay @kitofr I have pushed a new version of the filewwatcher gem today that can automatically restart long running processes, like web servers like this:

$ filewatcher --restart --dontwait "**/*.html" "python -m SimpleHTTPServer"

I was thinking about making automatic restart default behaviour in filewatcher. That means for instance that filewatcher as a default wouldn't wait for long running tests to finish if source files are updated. I don't know if this behaviour is desired. The advantage is that you don't have to remember any filewatcher switches to make it auto reload sinatra apps.

$ filewatcher "**/*.html" "ruby my_sinatra_app.rb"

Comments? :-)

from filewatcher.

acadet avatar acadet commented on September 26, 2024

Hey Thomas,

It works fine. You can upgrade filewatcher to make this option as default. However, I definitively think you should allow user to change behaviour if s/he wish ;)

Besides, I have noticed that, from now on, you need to surround file pattern to watch with quotes, whereas, before, this was not required.

Anyway, keep going like that man. Your gem is fantastic and really useful :)

from filewatcher.

thomasfl avatar thomasfl commented on September 26, 2024

Hi Adrien,

I too think that the default behaviour of filewatcher should be to restart the running process started be filewatcher. This is convenient when running tests and off course when you are running a webserver.

Instead of having an option called --restart', instead there should be an option called '--wait-to-finish, a hurry option that takes an argument --hurry false|true', or have an restart option that takes an argument--restart true|false`.

from filewatcher.

acadet avatar acadet commented on September 26, 2024

You should keep it simple. If --restart option has been provided, restart as soon as a watched file has been edited. Otherwise, run filewatcher using your default behaviour ;)
Ditto for --hurry (run command on start).

It could be the opposite, obviously, it's up to you. However, just spot if option has been provided or no. Investigating value is more complex, in my opinion.

from filewatcher.

thomasfl avatar thomasfl commented on September 26, 2024

Implemented. Thanks to @acadet for this great idea. I use it myself everyday.

from filewatcher.

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.