narqo/bem-pr — pull request #57 by SevInf (2013-10-28 17:31:14+00:00)
Title: Fix race when running tests from bem-server

Suppose that tests are running from bem server and user requests `desktop.sets/some.tests/default/default.html`. What happens:

1. Browser requests `desktop.sets/some.tests/default/default.html`;
2. Build is performed for this file and results are sent back to browser;
3. After loading html page, browser requests both `js` and `css` simultaneously;
4. Execution of build plan for `js` starts. As a part of a process, `bemjson.js` is created with `test-tmpl` tech;
5. Execution of build plan for `css` starts on different worker. `bemjson.js` is generated too for this step. In order to write it, `bem-tools` opens file with `w` flag, write content of the file and closes it.
6. Occasionally, building of `bemdecl.js` for `js` starts after `bemjson` file is opened in write mode by `css` plan (overriding its content), but before new content is written. Thus, no blocks from bemjson appear in bemdecl.

More general solution for i/o sync will be implemented in future versions of `bem-tools`, for now its just fix for bem-pr.