Created
May 19, 2024 23:45
-
-
Save ededejr/b303f838d64f850f1ef7b8c3b126a973 to your computer and use it in GitHub Desktop.
small nodejs sh wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ExecSyncOptions, execSync } from 'child_process'; | |
export function sh(command: TemplateStringsArray, ...substitutions: any[]) { | |
const fullCommand = command.reduce((acc, part, i) => acc + part + (substitutions[i] || ''), ''); | |
return (options?: ExecSyncOptions) => execSync(fullCommand, { encoding: 'utf-8', ...(options || {}) }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment