Files
Codeman/src/utils/nice-wrapper.ts
T

18 lines
520 B
TypeScript
Raw Normal View History

2026-02-12 11:35:10 +01:00
/**
* @fileoverview Shared utility for wrapping commands with `nice` priority.
*
2026-02-18 12:51:35 +01:00
* Extracted as a shared utility for tmux-manager and other consumers.
2026-02-12 11:35:10 +01:00
*
* @module utils/nice-wrapper
*/
import type { NiceConfig } from '../types.js';
/**
* Wraps a command with `nice` for priority adjustment.
*/
export function wrapWithNice(cmd: string, config: NiceConfig): string {
if (!config.enabled) return cmd;
const niceValue = Math.max(-20, Math.min(19, config.niceValue));
return `nice -n ${niceValue} ${cmd}`;
}