Skip to content

Commit 3679353

Browse files
authored
prime the .net env to avoid intro messages (#55)
1 parent 2ce6fc7 commit 3679353

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

generate_sdk_docs.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,5 +470,47 @@ def generate_docs():
470470
except Exception as e:
471471
print(f"Error processing {client_name}: {e}")
472472

473+
def perform_dummy_initial_run():
474+
"""
475+
Perform a dummy initial run to prime the .NET environment and clear startup messages.
476+
"""
477+
temp_cs_file = os.path.join(SAMPLES_PATH, "DummyProgram.cs")
478+
dummy_csproj_path = create_temp_project()
479+
480+
try:
481+
# Create a minimal dummy C# program
482+
with open(temp_cs_file, "w") as cs_file:
483+
cs_file.write(
484+
"""
485+
using System;
486+
487+
namespace Dummy
488+
{
489+
class Program
490+
{
491+
static void Main(string[] args)
492+
{
493+
Console.WriteLine("Dummy Run Completed.");
494+
}
495+
}
496+
}
497+
"""
498+
)
499+
500+
# Run the dummy program
501+
subprocess.run(
502+
["dotnet", "run", "--project", dummy_csproj_path, temp_cs_file],
503+
capture_output=True, text=True, check=True
504+
)
505+
506+
except subprocess.CalledProcessError as e:
507+
print("Error during dummy initial run:", e.stderr or e.stdout)
508+
509+
finally:
510+
# Clean up the dummy file after execution
511+
if os.path.exists(temp_cs_file):
512+
os.remove(temp_cs_file)
513+
473514
if __name__ == "__main__":
515+
perform_dummy_initial_run()
474516
generate_docs()

0 commit comments

Comments
 (0)