mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 13:31:23 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -39,14 +39,18 @@ export async function requestExecHostViaSocket(params: {
|
||||
timeoutMs?: number;
|
||||
}): Promise<ExecHostResponse | null> {
|
||||
const { socketPath, token, request } = params;
|
||||
if (!socketPath || !token) return null;
|
||||
if (!socketPath || !token) {
|
||||
return null;
|
||||
}
|
||||
const timeoutMs = params.timeoutMs ?? 20_000;
|
||||
return await new Promise((resolve) => {
|
||||
const client = new net.Socket();
|
||||
let settled = false;
|
||||
let buffer = "";
|
||||
const finish = (value: ExecHostResponse | null) => {
|
||||
if (settled) return;
|
||||
if (settled) {
|
||||
return;
|
||||
}
|
||||
settled = true;
|
||||
try {
|
||||
client.destroy();
|
||||
@@ -85,7 +89,9 @@ export async function requestExecHostViaSocket(params: {
|
||||
const line = buffer.slice(0, idx).trim();
|
||||
buffer = buffer.slice(idx + 1);
|
||||
idx = buffer.indexOf("\n");
|
||||
if (!line) continue;
|
||||
if (!line) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
const msg = JSON.parse(line) as {
|
||||
type?: string;
|
||||
|
||||
Reference in New Issue
Block a user