From 628b4c7b90ef4a56c6694026fcd3bfb54ddad26b Mon Sep 17 00:00:00 2001 From: Jun Kimura Date: Wed, 22 May 2024 17:27:46 +0900 Subject: [PATCH] improve the output of `runCmd` Signed-off-by: Jun Kimura --- test/CertificateTest.t.sol | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/CertificateTest.t.sol b/test/CertificateTest.t.sol index 68565c7..f880615 100644 --- a/test/CertificateTest.t.sol +++ b/test/CertificateTest.t.sol @@ -166,13 +166,11 @@ contract CertificateTest is BasicTest { } function runCmd(string[] memory cmd) internal { - // NOTE: vm.tryFfi will be supported after forge-std v1.6.1 - // Vm.FfiResult memory f = vm.tryFfi(cmd); - // string memory cmdStr; - // for (uint256 i = 0; i < cmd.length; i++) { - // cmdStr = string(abi.encodePacked(cmdStr, cmd[i], " ")); - // } - // require(f.exit_code == 0, cmdStr); - vm.ffi(cmd); + Vm.FfiResult memory f = vm.tryFfi(cmd); + string memory cmdStr; + for (uint256 i = 0; i < cmd.length; i++) { + cmdStr = string(abi.encodePacked(cmdStr, cmd[i], " ")); + } + require(f.exitCode == 0, string(abi.encodePacked("Failed to run command: ", cmdStr, " err: ", f.stderr))); } }