#!/usr/bin/env python3
with open('/home/guru/gururmm/agent/src/updater/mod.rs') as f:
    src = f.read()

# Find the Windows watchdog function
idx = src.find("async fn create_windows_rollback_watchdog")
if idx == -1:
    print("NOT FOUND")
else:
    # Find the format args block within the Windows watchdog
    chunk = src[idx:idx+3000]
    # Look for the replace call
    ri = chunk.find("replace")
    if ri != -1:
        print("FORMAT ARGS AREA:")
        print(repr(chunk[ri-20:ri+300]))
    else:
        print("replace not found in chunk")
        print(repr(chunk[:500]))
