Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running with -f patch always exits with code 1 #62

Open
doctordesh opened this issue Jan 24, 2024 · 1 comment
Open

Running with -f patch always exits with code 1 #62

doctordesh opened this issue Jan 24, 2024 · 1 comment

Comments

@doctordesh
Copy link

doctordesh commented Jan 24, 2024

Hello,

I'm using your fantastic tool to run diffs in a refactoring project. Works wonders! Today though, I tried to use the patch format instead, and even on files that are equal the output is [] (which might be by design) but the exit code is always 1, regardless if there are problems or not.

> ./jd --version
jd version 1.7.1
> echo "{}" > file1.json
> echo "{}" > file2.json
> ./jd -f patch file1.json file2.json
[]
> echo $?
1
> ./jd file1.json file2.json
> echo $?
0
@doctordesh
Copy link
Author

doctordesh commented Jan 24, 2024

I would guess that this is the problem. You always create an empty slice. Which means that json.Marshal further down will at least output [].

Then the first and last if here will fail and cause os.Exit(1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant