mirror of
https://github.com/jlengrand/Maestro.git
synced 2026-03-10 08:31:19 +00:00
refactor: extract magic number to named constant in execFile utility
Extracted the magic number `10 * 1024 * 1024` to a named constant `EXEC_MAX_BUFFER` for better code clarity and maintainability. Added explanatory comment documenting the 10MB buffer size limit. - Created EXEC_MAX_BUFFER constant at module top - Replaced inline magic number with constant reference - Added documentation comment Resolves housekeeping task #26
This commit is contained in:
@@ -3,6 +3,9 @@ import { promisify } from 'util';
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
|
||||
// Maximum buffer size for command output (10MB)
|
||||
const EXEC_MAX_BUFFER = 10 * 1024 * 1024;
|
||||
|
||||
export interface ExecResult {
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
@@ -22,7 +25,7 @@ export async function execFileNoThrow(
|
||||
const { stdout, stderr } = await execFileAsync(command, args, {
|
||||
cwd,
|
||||
encoding: 'utf8',
|
||||
maxBuffer: 10 * 1024 * 1024, // 10MB buffer
|
||||
maxBuffer: EXEC_MAX_BUFFER,
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user