aem-ext-daemon 0.3.6 → 0.3.7
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.
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* shell:exec runs a command and returns the full output.
|
|
6
6
|
*/
|
|
7
7
|
import { execSync, spawn } from "node:child_process";
|
|
8
|
+
import fs from "node:fs";
|
|
8
9
|
import os from "node:os";
|
|
9
10
|
const EXEC_TIMEOUT = 120_000; // 2 minutes
|
|
10
11
|
const MAX_BUFFER = 5 * 1024 * 1024; // 5MB
|
|
@@ -39,6 +40,11 @@ function getEnhancedEnv() {
|
|
|
39
40
|
export function exec(command, cwd) {
|
|
40
41
|
if (!command)
|
|
41
42
|
throw new Error("command is required");
|
|
43
|
+
// Ensure the working directory exists locally — the server may have
|
|
44
|
+
// computed the path but only created it on its own filesystem.
|
|
45
|
+
if (!fs.existsSync(cwd)) {
|
|
46
|
+
fs.mkdirSync(cwd, { recursive: true });
|
|
47
|
+
}
|
|
42
48
|
// Redirect stderr to stdout so we capture everything, and ensure
|
|
43
49
|
// no interactive prompts leak to the daemon terminal.
|
|
44
50
|
// Also set CI=true and TERM=dumb so CLIs skip interactive prompts.
|
|
@@ -84,6 +90,9 @@ export function checkAio() {
|
|
|
84
90
|
*/
|
|
85
91
|
export function runAio(args, cwd, requestId, connection) {
|
|
86
92
|
return new Promise((resolve, reject) => {
|
|
93
|
+
if (!fs.existsSync(cwd)) {
|
|
94
|
+
fs.mkdirSync(cwd, { recursive: true });
|
|
95
|
+
}
|
|
87
96
|
const child = spawn("aio", args, {
|
|
88
97
|
cwd,
|
|
89
98
|
shell: getUserShell(),
|