You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Errors in a solidity script caused by reverts, asserts, etc, induce a non-zero exit code. However, running the script with the --json option always returns zero.
$ forge script AlwaysReverts --json &&echo"success"
[⠰] Compiling...
[⠔] Compiling 4 files with 0.8.14
[⠃] Compiling 6 files with 0.8.9
[⠊] Solc 0.8.9 finished in 1.27s
[⠆] Solc 0.8.14 finished in 1.29s
Compiler run successful
{"logs":[],"gas_used":299261,"returns":{}}
success
$ forge script AlwaysReverts &&echo exited
[⠰] Compiling...
[⠑] Compiling 5 files with 0.8.9
[⠃] Solc 0.8.9 finished in 1.24s
Compiler run successful
Script failed.
Gas used: 299261
== Return ==
Error:
Script failed.
This is a surprising behavior and I'd expect the exit status when adding --json to work the same way without the option.
The text was updated successfully, but these errors were encountered:
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (2f4dc6c 2022-07-29T00:03:54.821792323Z)
What command(s) is the bug in?
forge script --json Contract
Operating System
Linux
Describe the bug
Errors in a solidity script caused by reverts, asserts, etc, induce a non-zero exit code. However, running the script with the
--json
option always returns zero.This is a surprising behavior and I'd expect the exit status when adding
--json
to work the same way without the option.The text was updated successfully, but these errors were encountered: