|
| 1 | +require "json" |
1 | 2 | require "tempfile" |
2 | 3 | require "open3" |
3 | 4 | require_relative "language_configs" |
@@ -36,16 +37,17 @@ def execute_with_config(code_content, lang_config, temp_dir, lang_key, input_fil |
36 | 37 | temp_file_suffix = lang_config[:temp_file_suffix] |
37 | 38 |
|
38 | 39 | if temp_file_suffix |
39 | | - execute_with_temp_file(code_content, cmd_lambda, temp_file_suffix, temp_dir, lang_key, input_file_path, explain, flamegraph) |
| 40 | + write_code_to_temp_file = lang_config.fetch(:write_code_to_temp_file, true) |
| 41 | + execute_with_temp_file(code_content, cmd_lambda, temp_file_suffix, temp_dir, lang_key, input_file_path, explain, flamegraph, write_code_to_temp_file) |
40 | 42 | else |
41 | 43 | execute_direct_command(code_content, cmd_lambda, input_file_path, explain, flamegraph) |
42 | 44 | end |
43 | 45 | end |
44 | 46 |
|
45 | | - def execute_with_temp_file(code_content, cmd_lambda, temp_file_suffix, temp_dir, lang_key, input_file_path = nil, explain = false, flamegraph = false) |
| 47 | + def execute_with_temp_file(code_content, cmd_lambda, temp_file_suffix, temp_dir, lang_key, input_file_path = nil, explain = false, flamegraph = false, write_code_to_temp_file = true) |
46 | 48 | result = nil |
47 | 49 | Tempfile.create([lang_key, temp_file_suffix], temp_dir) do |temp_file| |
48 | | - temp_file.write(code_content) |
| 50 | + temp_file.write(code_content) if write_code_to_temp_file |
49 | 51 | temp_file.close |
50 | 52 | command_to_run, exec_options = cmd_lambda.call(**{ |
51 | 53 | code_content: code_content, |
|
0 commit comments