@sahu-01/openpaw 1.0.2 → 1.0.4
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 +22 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -231066,12 +231066,24 @@ async function startGateway(config = {}) {
|
|
|
231066
231066
|
if (processedFiles.length > 0) {
|
|
231067
231067
|
console.log(`Decrypted ${processedFiles.length} auth-profiles.json file(s)`);
|
|
231068
231068
|
}
|
|
231069
|
+
const isWindows = process.platform === "win32";
|
|
231070
|
+
const spawnOpenClaw = (command, args = []) => {
|
|
231071
|
+
if (isWindows) {
|
|
231072
|
+
return (0, import_child_process.spawn)("cmd.exe", ["/c", command, ...args], {
|
|
231073
|
+
stdio: "inherit",
|
|
231074
|
+
env: { ...process.env }
|
|
231075
|
+
});
|
|
231076
|
+
} else {
|
|
231077
|
+
return (0, import_child_process.spawn)(command, args, {
|
|
231078
|
+
stdio: "inherit",
|
|
231079
|
+
env: { ...process.env },
|
|
231080
|
+
shell: true
|
|
231081
|
+
});
|
|
231082
|
+
}
|
|
231083
|
+
};
|
|
231069
231084
|
if (openclawBinary) {
|
|
231070
|
-
console.log(`Starting OpenClaw: ${openclawBinary}`);
|
|
231071
|
-
openclawProcess = (
|
|
231072
|
-
stdio: "inherit",
|
|
231073
|
-
env: { ...process.env }
|
|
231074
|
-
});
|
|
231085
|
+
console.log(`Starting OpenClaw: ${openclawBinary} gateway`);
|
|
231086
|
+
openclawProcess = spawnOpenClaw(openclawBinary, ["gateway"]);
|
|
231075
231087
|
openclawProcess.on("exit", async (code) => {
|
|
231076
231088
|
console.log(`OpenClaw exited with code ${code}`);
|
|
231077
231089
|
await cleanup();
|
|
@@ -231080,14 +231092,11 @@ async function startGateway(config = {}) {
|
|
|
231080
231092
|
openclawProcess.on("error", async (err) => {
|
|
231081
231093
|
console.error(`Failed to start OpenClaw: ${err.message}`);
|
|
231082
231094
|
await cleanup();
|
|
231095
|
+
process.exit(1);
|
|
231083
231096
|
});
|
|
231084
231097
|
} else {
|
|
231085
|
-
console.log("Starting OpenClaw via npx
|
|
231086
|
-
openclawProcess = (
|
|
231087
|
-
stdio: "inherit",
|
|
231088
|
-
env: { ...process.env },
|
|
231089
|
-
shell: true
|
|
231090
|
-
});
|
|
231098
|
+
console.log("Starting OpenClaw via npx: openclaw gateway");
|
|
231099
|
+
openclawProcess = spawnOpenClaw("npx", ["openclaw", "gateway"]);
|
|
231091
231100
|
openclawProcess.on("exit", async (code) => {
|
|
231092
231101
|
console.log(`OpenClaw exited with code ${code}`);
|
|
231093
231102
|
await cleanup();
|
|
@@ -231095,7 +231104,8 @@ async function startGateway(config = {}) {
|
|
|
231095
231104
|
});
|
|
231096
231105
|
openclawProcess.on("error", async (err) => {
|
|
231097
231106
|
console.error(`Failed to start OpenClaw: ${err.message}`);
|
|
231098
|
-
|
|
231107
|
+
await cleanup();
|
|
231108
|
+
process.exit(1);
|
|
231099
231109
|
});
|
|
231100
231110
|
}
|
|
231101
231111
|
return {
|