Supplying --port free (as per help output) throws an exception.
Unhandled Exception: System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at Microsoft.FSharp.Core.LanguagePrimitives.ParseInt32(String s)
at Fable.Tools.Main.parseArguments(String[] args)
at Fable.Tools.Main.main(String[] argv)
Alright, I think the problem was here:
let tryFindArgValue key (args: string[]) =
match args |> Array.tryFindIndex ((=) key) with
| Some i -> Some args.[i]
| None -> None
which should be (I committed it by mistake, not tested)
let tryFindArgValue key (args: string[]) =
match args |> Array.tryFindIndex ((=) key) with
// i is the index of the key
// i + 1 is the index of arg value
| Some i ->
// if args.[i] is the last element
if args.Length = i + 1
then None
else Some args.[i + 1]
| None -> None
Nice catch @Zaid-Ajaj! Could you please send a PR to fix it?
@alfonsogarciacaro Sure thing!
I have published 1.0.5 with the fix, thanks again @Zaid-Ajaj
Wouldn't it be a good idea to add a unit test to avoid regressions again?
It is! Are you volunteering? :wink:
While doing random programming things is way funner than writing master thesis, I still should keep on track for the last few weeks :P
Fix was published, I will close this for now, re-open if issue persists
So, the exception is gone, but now the switch doesn't seem to do anything ^^
/Users/alxandr/hub/Fable.Ava/dotnetsdk/dotnet fable node-run --port free "/Users/alxandr/hub/Fable.Ava/build.js"
Cannot start server, please check the port 61225 is free: Address already in use
Ah, sorry, my bad. I had to put it after the js file name.