Skip to content

Commit 2e28c4b

Browse files
committed
remove unused code
1 parent 3f80bb1 commit 2e28c4b

File tree

1 file changed

+19
-41
lines changed

1 file changed

+19
-41
lines changed

rescript

+19-41
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ function releaseBuild() {
173173
is_building = false;
174174
}
175175
}
176+
177+
// We use [~perm:0o664] rather than our usual default perms, [0o666], because
178+
// lock files shouldn't rely on the umask to disallow tampering by other.
176179
function acquireBuild() {
177180
if (is_building) {
178181
return false;
@@ -285,55 +288,30 @@ if (
285288

286289
function onUncaughtException(err) {
287290
console.error("Uncaught Exception", err);
291+
releaseBuild();
288292
process.exit(1);
289293
}
290-
function onExit() {
291-
try {
292-
fs.unlinkSync(lockFileName);
293-
} catch (err) {
294-
process.exitCode = 1;
295-
}
296-
}
297294
function exitProcess() {
295+
releaseBuild();
298296
process.exit(0);
299297
}
300298

301-
/**
302-
* @return {boolean}
303-
*/
304-
function acquireLockFile() {
305-
try {
306-
// We use [~perm:0o664] rather than our usual default perms, [0o666], because
307-
// lock files shouldn't rely on the umask to disallow tampering by other.
308-
var fd = fs.openSync(lockFileName, "wx", 0o664);
309-
try {
310-
fs.writeFileSync(fd, String(process.pid), "ascii");
311-
fs.closeSync(fd);
312-
} catch (err) {}
313-
314-
process.on("exit", onExit);
315-
process.on("uncaughtException", onUncaughtException);
299+
process.on("uncaughtException", onUncaughtException);
316300

317-
// OS signal handlers
318-
// Ctrl+C
319-
process.on("SIGINT", exitProcess);
320-
// kill pid
321-
process.on("SIGUSR1", exitProcess);
322-
process.on("SIGUSR2", exitProcess);
323-
process.on("SIGTERM", exitProcess);
324-
process.on("SIGHUP", exitProcess);
301+
// OS signal handlers
302+
// Ctrl+C
303+
process.on("SIGINT", exitProcess);
304+
// kill pid
305+
process.on("SIGUSR1", exitProcess);
306+
process.on("SIGUSR2", exitProcess);
307+
process.on("SIGTERM", exitProcess);
308+
process.on("SIGHUP", exitProcess);
325309

326-
process.stdin.on("close", exitProcess);
327-
// close when stdin stops
328-
if (os.platform() !== "win32") {
329-
process.stdin.on("end", exitProcess);
330-
process.stdin.resume();
331-
}
332-
333-
return true;
334-
} catch (exn) {
335-
return false;
336-
}
310+
process.stdin.on("close", exitProcess);
311+
// close when stdin stops
312+
if (os.platform() !== "win32") {
313+
process.stdin.on("end", exitProcess);
314+
process.stdin.resume();
337315
}
338316

339317
var sourcedirs = path.join("lib", "bs", ".sourcedirs.json");

0 commit comments

Comments
 (0)