safeExec (utils/common.ts)

bruno · packages/bruno-requests/src/network/system-proxy/utils/common.ts · typescript · MIT
integration

Utility functions for safely executing child processes and normalizing proxy URLs.

// Source: https://github.com/usebruno/bruno | License: MIT
// Provided via justclaw.it.com; keep this notice with the code.
import { execFile, ExecFileOptions } from 'node:child_process';
import { promisify } from 'node:util';

export const execFileAsync = promisify(execFile);

/**
 * Safely execute a command without shell interpretation.
 * Returns stdout on success, null on error.
 *
 * @param bin - The binary/command to execute
 * @param args - Array of arguments to pass to the command
 * @param opts - ExecFileOptions (timeout, maxBuffer, etc.)
 * @returns stdout trimmed on success, null on error
 */
export async function safeExec(bin: string, args: string[], opts: ExecFileOptions): Promise<string | null> {
  try {
    const { stdout } = await execFileAsync(bin, args, opts);
    return

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key