From d5e86c312dbef3066a22d49fff3a93632fe3f0d7 Mon Sep 17 00:00:00 2001 From: Ofek Shilon Date: Thu, 22 Aug 2024 13:27:33 +0300 Subject: [PATCH] Fix in clang-format arg handling --- lib/tooling/clang-format-tool.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/tooling/clang-format-tool.ts b/lib/tooling/clang-format-tool.ts index d59d4f5df8a..2a686e14922 100644 --- a/lib/tooling/clang-format-tool.ts +++ b/lib/tooling/clang-format-tool.ts @@ -54,9 +54,11 @@ export class ClangFormatTool extends BaseTool { } await fs.writeFile(path.join(dir, 'compile_flags.txt'), compileFlags.join('\n')); - const clang_format_file = path.join(dir, 'clang_format_options.txt'); - await fs.writeFile(clang_format_file, stdin); - args.push(`-style=file:${clang_format_file}`); + if (stdin !== '') { + const clang_format_file = path.join(dir, 'clang_format_options.txt'); + await fs.writeFile(clang_format_file, stdin); + args.push(`-style=file:${clang_format_file}`); + } return await super.runTool(compilationInfo, sourcefile, args, stdin); } }