phoenix icon indicating copy to clipboard operation
phoenix copied to clipboard

Let watchers execute batch files on Windows

Open eteeselink opened this issue 2 years ago • 4 comments

Turns out your ping helped Jose! As discussed in #4617, here's an attempt to let Phoenix watchers run batch files more easily.

I took care to not blanket pass any command to cmd /c on Windows, because that's a step in the direction of the same kind of hell that writing package.json scripts is, with people trying to write scripts that are both valid sh and valid cmd or something like that.

This should keep the old behavior in tact unless:

  1. the user is on Windows
  2. the executable specified is found in the system PATH (plus opts[:cd]) and ends with .cmd or .bat

I like to think that that can't cause breaking changes since any watcher that matches point 2 above would've failed previously (System.cmd's find_executable call would find it, but subsequently fail to launch it) (come to think of it, that's a bit of a "bad error message" kind of bug in System.cmd isn't it?)

Note that this is my first proper Elixir ecosystem contribution and I'm not a very seasoned Elixir dev by any means. Any code commentary (or straights edits) will be warmly appreciated.

eteeselink avatar Dec 18 '21 23:12 eteeselink