sandboxbox 2.3.2 ā 2.3.3
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/package.json +1 -1
- package/utils/podman.js +66 -10
package/package.json
CHANGED
package/utils/podman.js
CHANGED
@@ -42,8 +42,18 @@ export function setupBackendNonBlocking(podmanPath) {
|
|
42
42
|
console.log(color('yellow', '\nš§ Initializing Podman backend (one-time setup, takes 2-3 minutes)...'));
|
43
43
|
|
44
44
|
try {
|
45
|
-
|
46
|
-
|
45
|
+
// Check existing machines with timeout
|
46
|
+
let machines = [];
|
47
|
+
try {
|
48
|
+
const machineListOutput = execSync(`"${podmanPath}" machine list --format json`, {
|
49
|
+
...execOptions,
|
50
|
+
timeout: 10000 // 10 seconds timeout
|
51
|
+
});
|
52
|
+
machines = JSON.parse(machineListOutput || '[]');
|
53
|
+
console.log(color('cyan', ` Found ${machines.length} existing machine(s)`));
|
54
|
+
} catch (machineListError) {
|
55
|
+
console.log(color('yellow', ' Could not list machines, assuming no machines exist'));
|
56
|
+
}
|
47
57
|
|
48
58
|
if (machines.length === 0) {
|
49
59
|
console.log(color('cyan', ' Creating Podman machine...'));
|
@@ -51,19 +61,64 @@ export function setupBackendNonBlocking(podmanPath) {
|
|
51
61
|
? `"${podmanPath}" machine init --rootful=false`
|
52
62
|
: `"${podmanPath}" machine init`;
|
53
63
|
|
54
|
-
|
64
|
+
try {
|
65
|
+
execSync(initCmd, {
|
66
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
67
|
+
shell: true,
|
68
|
+
timeout: 120000 // 2 minutes
|
69
|
+
});
|
70
|
+
} catch (initError) {
|
71
|
+
const errorOutput = initError.stdout?.toString() + initError.stderr?.toString();
|
72
|
+
if (errorOutput?.includes('already exists') ||
|
73
|
+
errorOutput?.includes('VM already exists') ||
|
74
|
+
initError.message.includes('already exists')) {
|
75
|
+
console.log(color('cyan', ' Machine already exists, proceeding...'));
|
76
|
+
} else {
|
77
|
+
console.log(color('red', ` Error output: ${errorOutput}`));
|
78
|
+
throw initError;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
} else {
|
82
|
+
console.log(color('cyan', ' Using existing machine'));
|
83
|
+
}
|
84
|
+
|
85
|
+
console.log(color('cyan', ' Checking machine status...'));
|
86
|
+
try {
|
87
|
+
const statusOutput = execSync(`"${podmanPath}" machine list`, {
|
88
|
+
encoding: 'utf-8',
|
89
|
+
stdio: 'pipe',
|
90
|
+
shell: true,
|
91
|
+
timeout: 10000
|
92
|
+
});
|
93
|
+
|
94
|
+
if (statusOutput.includes('Running')) {
|
95
|
+
console.log(color('green', ' Machine is already running'));
|
96
|
+
} else {
|
97
|
+
console.log(color('cyan', ' Starting Podman machine...'));
|
98
|
+
execSync(`"${podmanPath}" machine start`, {
|
99
|
+
stdio: 'inherit',
|
100
|
+
shell: true,
|
101
|
+
timeout: 180000 // 3 minutes
|
102
|
+
});
|
103
|
+
}
|
104
|
+
} catch (statusError) {
|
105
|
+
console.log(color('cyan', ' Could not check status, attempting to start machine...'));
|
106
|
+
execSync(`"${podmanPath}" machine start`, {
|
55
107
|
stdio: 'inherit',
|
56
108
|
shell: true,
|
57
|
-
timeout:
|
109
|
+
timeout: 180000 // 3 minutes
|
58
110
|
});
|
59
111
|
}
|
60
112
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
113
|
+
// Verify backend is actually working
|
114
|
+
console.log(color('cyan', ' Verifying backend connection...'));
|
115
|
+
try {
|
116
|
+
execSync(`"${podmanPath}" info`, execOptions);
|
117
|
+
} catch (verifyError) {
|
118
|
+
console.log(color('red', ` Backend verification failed: ${verifyError.message}`));
|
119
|
+
console.log(color('yellow', ' Please ensure Podman machine is running manually'));
|
120
|
+
return false;
|
121
|
+
}
|
67
122
|
|
68
123
|
console.log(color('green', '\nā
Podman backend setup completed!\n'));
|
69
124
|
return true;
|
@@ -72,6 +127,7 @@ export function setupBackendNonBlocking(podmanPath) {
|
|
72
127
|
console.log(color('red', '\nā Setup timed out. Please run manually:'));
|
73
128
|
} else {
|
74
129
|
console.log(color('red', `\nā Setup failed: ${setupError.message}`));
|
130
|
+
console.log(color('red', ` Error details: ${setupError.stack}`));
|
75
131
|
}
|
76
132
|
|
77
133
|
const manualCmd = process.platform === 'win32'
|