Amber: Amber Watch - shouldn't start any server if compilation fails

Created on 10 Jan 2018  路  8Comments  路  Source: amberframework/amber

Description

When developing with amber w, the server compiles and restarts automatically. However if the server has started once, and a successive restart fails to compile, the watch will just restart the old version of the server.

With the new logging, one request is enough to make the compiler errors disappear, and it can be confusing why new changes aren't showing up.

Steps to Reproduce

  1. build app, run amber watch, ensure app starts successfully
  2. make a change to the app which will fail to compile.
  3. observe compilation fails and then the server starts

Expected behavior:

I think it makes sense to terminate the server and wait for a new change to retry compiling.

Actual behavior:

Server starts with old code.

Reproduces how often: 100%

Versions

> amber --version
Amber CLI (amberframework.org) - v0.6.0
> crystal --version
Crystal 0.24.1 (2017-12-26)

LLVM: 5.0.1
Default target: x86_64-apple-macosx

image

enhancement

Most helpful comment

We should also add Process.new(args...).wait to avoid NPM from starting before the amber w is complete.

I think this is making amber watch a bit slow. I changed it to run NPM once and in parallel, so we can have both as fast as possible watching the project files.

I'm not sure the process order matters to me. I'd rather have both start as soon as possible so the server refresh time is as fast as possible.

I agree 馃憤

All 8 comments

Hi, fixed here.

I'm just failed fixing this. (I don't know how/why this happen 馃槄 )

@faustinoaq with all the different work floating around with the watcher, I was hoping that this issue was already being worked on. Thank you!

We should also add Process.new(args...).wait to avoid NPM from starting before the amber w is complete. Also I was considering that we change the order of the processes, NPM install first then Amber Watch. WDYGT?

I'm not sure the process order matters to me. I'd rather have both start as soon as possible so the server refresh time is as fast as possible.

We should also add Process.new(args...).wait to avoid NPM from starting before the amber w is complete.

I think this is making amber watch a bit slow. I changed it to run NPM once and in parallel, so we can have both as fast as possible watching the project files.

I'm not sure the process order matters to me. I'd rather have both start as soon as possible so the server refresh time is as fast as possible.

I agree 馃憤

I think, this is fixed on v0.6.2:

09:02:08 Watcher | Watching file: ././src/blog.cr
09:02:08 Watcher | Watching file: ././src/controllers/home_controller.cr
09:02:08 Watcher | Watching file: ././src/controllers/application_controller.cr
09:02:08 Watcher | Watching file: ././config/routes.cr
09:02:08 Watcher | Watching file: ././config/application.cr
09:02:08 Watcher | Watching file: ././src/views/layouts/application.slang
09:02:08 Watcher | Watching file: ././src/views/layouts/_nav.slang
09:02:08 Watcher | Watching file: ././src/views/home/index.slang
09:02:08 Watcher | Building project Blog...
Syntax error in src/blog.cr:5: for empty hashes use '{} of KeyType => ValueType'

{}
^

09:02:08 Watcher | Compile time errors detected. Shutting down...

@faustinoaq which PRs address these issues?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aarongodin picture aarongodin  路  7Comments

sumwatt picture sumwatt  路  4Comments

faustinoaq picture faustinoaq  路  6Comments

faustinoaq picture faustinoaq  路  4Comments

Meldanor picture Meldanor  路  4Comments