Skip to content

Commit b71ecaf

Browse files
committed
add comments about (a)sync processing
1 parent ad22c1f commit b71ecaf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

scripts/rescript_format.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ async function main(argv, rescript_exe, bsc_exe) {
135135
}
136136
files = output.stdout.split("\n").map(x => x.trim());
137137
var incorrectlyFormattedFiles = 0;
138+
// it's ok that this processing is asynchronous
139+
// given we only write one-liners during it
140+
// so stdout should not get mixed (or can oneliners actually be mixed too?)
138141
try {
139142
const _promises = await Promise.all(
140143
files.map(async file => {
@@ -218,6 +221,7 @@ async function main(argv, rescript_exe, bsc_exe) {
218221
files.forEach(file => {
219222
var write = isSupportedFile(file) && !check.val;
220223
var flags = write ? ["-o", file, "-format", file] : ["-format", file];
224+
// we make this processing synchronous in order not to mix stdout
221225
try {
222226
const formatted = child_process.execFileSync(bsc_exe, flags);
223227
if (!write) {

0 commit comments

Comments
 (0)