Semantic Diff

#9247 Refuse to clean while a watcher of the project runs

1 commit

827be160cce2386954ea3cf27d3c106540cb2bf6..pr-9247

323c05fac · cknitt + Claude · Nov 06, 2026, 20:31 UTC

Refuse to clean while a watcher of the project runs

Why

rescript clean took only the build lock, which a watcher holds only while it builds, so a clean during rescript watch removed the artifacts the watcher kept reading, and every later rebuild failed (#9241).

addedDiagnostic rescript clean while rescript watch runs

text
Before
After
Cleaning x, exit 0; the watcher then fails with Sys_error("<root>/lib/rescript/A.ast: No such file or directory")exit 1; the artifacts and the watcher are left as they were
diagnostic
After
Could not clean while rescript watch or another clean is running. The process ID (PID) is 4242

Clean now takes the watch lock of the folder it cleans, as rescript watch does, before the build lock.

Review

  • Does a clean of a workspace see a watcher of one of its members? No: each takes the watch lock of the folder it was given, and a watcher takes it before it reads the configuration, which a test requires.