quinnj / JSON3.jl

Other
214 stars 47 forks source link

Tests with `echo` fail on Windows #153

Closed jaakkor2 closed 2 years ago

jaakkor2 commented 3 years ago

Julia 1.6.1, JSON3 1.8.1

JSON3: Error During Test at C:\Users\jru\.julia\packages\JSON3\A0XBc\test\json.jl:733
  Test threw exception
  Expression: (JSON3.read(`echo \{\"i\":1\}`)).i == 1
  IOError: could not spawn `echo '{"i":1}'`: no such file or directory (ENOENT)
...
JSON3: Error During Test at C:\Users\jru\.julia\packages\JSON3\A0XBc\test\json.jl:734
  Test threw exception
  Expression: (JSON3.read(`echo` & `echo \{\"i\":1\}`)).i == 1
  IOError: could not spawn `echo`: no such file or directory (ENOENT)

On Windows echo is an internal command.

julia> run(`echo foo`)
ERROR: IOError: could not spawn `echo foo`: no such file or directory (ENOENT)
Stacktrace:
...

One could define the commands like

run(`cmd /c echo foo`)

but I could not figure out how to escape the double quotes in the string to print {"i": 1}.

quinnj commented 2 years ago

I think it's just easier to not run those tests on windows: https://github.com/quinnj/JSON3.jl/commit/b409366409910ea3f6ac3f5c59212896fafc4d13