diff --git a/contrib/verify_ffi.py b/contrib/verify_ffi.py index 9580fff2d..a4d0393f2 100755 --- a/contrib/verify_ffi.py +++ b/contrib/verify_ffi.py @@ -35,7 +35,10 @@ def generate_ffi_docs(crate_dir: Path) -> tuple[str, int, str]: capture_output=True, text=True ) - return crate_dir.name, result.returncode, result.stdout + output = result.stdout + if result.returncode != 0 and result.stderr: + output = result.stderr + return crate_dir.name, result.returncode, output def main(): diff --git a/dash-spv-ffi/scripts/generate_ffi_docs.py b/dash-spv-ffi/scripts/generate_ffi_docs.py index c0b65210a..1b8c9c4bb 100755 --- a/dash-spv-ffi/scripts/generate_ffi_docs.py +++ b/dash-spv-ffi/scripts/generate_ffi_docs.py @@ -29,7 +29,7 @@ def extract_ffi_functions(file_path: Path) -> List[FFIFunction]: """ functions: List[FFIFunction] = [] - with open(file_path, 'r') as f: + with open(file_path, 'r', encoding='utf-8') as f: content = f.read() # Iterate over all #[no_mangle] attribute occurrences @@ -370,7 +370,7 @@ def main(): # Write to file output_file = Path(__file__).parent.parent / "FFI_API.md" - with open(output_file, 'w') as f: + with open(output_file, 'w', encoding='utf-8') as f: f.write(markdown) print(f"Generated FFI documentation with {len(all_functions)} functions") diff --git a/key-wallet-ffi/scripts/generate_ffi_docs.py b/key-wallet-ffi/scripts/generate_ffi_docs.py index faa22e53d..57f27b16a 100755 --- a/key-wallet-ffi/scripts/generate_ffi_docs.py +++ b/key-wallet-ffi/scripts/generate_ffi_docs.py @@ -28,7 +28,7 @@ def extract_ffi_functions(file_path: Path) -> List[FFIFunction]: """ functions: List[FFIFunction] = [] - with open(file_path, 'r') as f: + with open(file_path, 'r', encoding='utf-8') as f: content = f.read() for m in re.finditer(r'(?m)^\s*#\[no_mangle\]\s*$', content): @@ -309,7 +309,7 @@ def main(): # Write to file output_file = Path(__file__).parent.parent / "FFI_API.md" - with open(output_file, 'w') as f: + with open(output_file, 'w', encoding='utf-8') as f: f.write(markdown) print(f"Generated FFI documentation with {len(all_functions)} functions")