amber icon indicating copy to clipboard operation
amber copied to clipboard

amber watch breaks gets

Open faissaloo opened this issue 4 years ago • 4 comments

Description

Can't use amber watch if startup depends on gets

Steps to Reproduce

  1. Add a use of gets to the amber application, e.g: in the .cr
  2. Run amber watch

Expected behavior: [What you expect to happen] The process will be blocked while waiting for the user's input

Actual behavior: [What actually happens] The application does not wait for the users input

Reproduces how often: [What percentage of the time does it reproduce?] 100%

Versions

Amber CLI (amberframework.org) - v0.31.0
Crystal 0.30.1 [5e6a1b672] (2019-08-12)

LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu

Additional Information

My application has a first startup wizard that runs, this behaviour is breaking that meaning I need to use shards build every time I make a change while manually testing initial setup.

faissaloo avatar Feb 09 '20 00:02 faissaloo

What file are you adding it into?

elorest avatar Feb 09 '20 00:02 elorest

src/<MY APPLICATION NAME>.cr, the same file that calls Amber::Server.start

faissaloo avatar Feb 09 '20 00:02 faissaloo

gets would break auto reload which the the purpose of watch. If you want to capture stdin run crystal src/project.cr instead.

elorest avatar Feb 09 '20 19:02 elorest

gets shouldn't break autoreload though, autoreload shouldn't affect the running of the program. I'm not 100% on the architecture you've got going rn, but you should be able to put it in another thread then just kill it when you need to reload.

faissaloo avatar Feb 09 '20 23:02 faissaloo