tshort / StaticCompiler.jl

Compiles Julia code to a standalone library (experimental)
Other
499 stars 30 forks source link

Proposed fix for `try`/`catch` around `diff` #75

Closed Seelengrab closed 1 year ago

Seelengrab commented 2 years ago

https://github.com/tshort/StaticCompiler.jl/blob/0cfcfdcfa77ae7a72154d8c3e42f5b4044efea34/src/pointer_patching.jl#L170-L175

diff by default indicates with its return code whether two diffs differ at all:

>man diff
[...]
Exit status is 0 if inputs are the same, 1  if  different,  2  if trouble.

so this piece of code is probably better suited by something like

pdiff = run(Cmd(`diff $path1 $path2`, ignorestatus=true))
pdiff.exitcode == 2 && error("Showing diff caused an error")

Maybe even with a pipeline for stderr?