automata-cli 0.10.0-develop.403 → 0.10.0-develop.408
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +26 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4681,12 +4681,14 @@ import {
|
|
|
4681
4681
|
accessSync as accessSync2,
|
|
4682
4682
|
appendFileSync,
|
|
4683
4683
|
constants as constants2,
|
|
4684
|
+
mkdirSync as mkdirSync2,
|
|
4684
4685
|
readFileSync as readFileSync6,
|
|
4685
4686
|
renameSync as renameSync2,
|
|
4686
4687
|
unlinkSync as unlinkSync3,
|
|
4687
4688
|
writeFileSync as writeFileSync3
|
|
4688
4689
|
} from "fs";
|
|
4689
4690
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
4691
|
+
import { tmpdir, userInfo } from "os";
|
|
4690
4692
|
import { dirname as dirname2, join as join5 } from "path";
|
|
4691
4693
|
var EXECUTION_LOG_FILE = "automata-execution.log";
|
|
4692
4694
|
var WORK_LOG_FILE = "automata-work.log";
|
|
@@ -4701,7 +4703,25 @@ var OUTCOMES = [
|
|
|
4701
4703
|
"deferred"
|
|
4702
4704
|
];
|
|
4703
4705
|
function operationLogDirectory() {
|
|
4704
|
-
|
|
4706
|
+
const parent = dirname2(process.cwd());
|
|
4707
|
+
try {
|
|
4708
|
+
accessSync2(parent, constants2.W_OK);
|
|
4709
|
+
return parent;
|
|
4710
|
+
} catch {
|
|
4711
|
+
return fallbackLogDirectory();
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4714
|
+
function fallbackLogDirectory() {
|
|
4715
|
+
return join5(tmpdir(), `automata-${userSegment()}`);
|
|
4716
|
+
}
|
|
4717
|
+
function userSegment() {
|
|
4718
|
+
const uid = process.getuid?.();
|
|
4719
|
+
if (uid !== void 0) return String(uid);
|
|
4720
|
+
try {
|
|
4721
|
+
return userInfo().username.replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
4722
|
+
} catch {
|
|
4723
|
+
return "user";
|
|
4724
|
+
}
|
|
4705
4725
|
}
|
|
4706
4726
|
function inspectLogDirectory(dir = operationLogDirectory(), cwd = process.cwd()) {
|
|
4707
4727
|
try {
|
|
@@ -4834,6 +4854,11 @@ function appendWithRetention(dir, file, content, retain) {
|
|
|
4834
4854
|
}
|
|
4835
4855
|
}
|
|
4836
4856
|
function recordTick(tick, dir = operationLogDirectory()) {
|
|
4857
|
+
try {
|
|
4858
|
+
if (dir === fallbackLogDirectory()) mkdirSync2(dir, { recursive: true, mode: 448 });
|
|
4859
|
+
} catch {
|
|
4860
|
+
return;
|
|
4861
|
+
}
|
|
4837
4862
|
try {
|
|
4838
4863
|
accessSync2(dir, constants2.W_OK);
|
|
4839
4864
|
} catch {
|