script.js
This file
Path
lib/methods/script.js
22 lines · 1015 bytes · JavaScript
Last changed by
Add more code comments (#984)ehmickybefore adoptionfdd8a9f
History of this fileTake it
Add more code comments (#984)ehmickybefore adoptionfdd8a9f
line 1why, one step back1// Sets `$.sync` and `$.s`Rename files (#977)ehmickybefore adoption4b2e316
lines 2–6why, one step back2export const setScriptSync = (boundExeca, createNested, boundOptions) => {3 boundExeca.sync = createNested(mapScriptSync, boundOptions);4 boundExeca.s = boundExeca.sync;5};6Add more code comments (#984)ehmickybefore adoptionfdd8a9f
line 7why, one step back7// Main logic for `$`Rename files (#977)ehmickybefore adoption4b2e316
line 8why, one step back8export const mapScriptAsync = ({options}) => getScriptOptions(options);Add more code comments (#984)ehmickybefore adoptionfdd8a9f
lines 9–10why, one step back910// Main logic for `$.sync`Rename files (#977)ehmickybefore adoption4b2e316
lines 11–12why, one step back11const mapScriptSync = ({options}) => ({...getScriptOptions(options), isSync: true});12Add more code comments (#984)ehmickybefore adoptionfdd8a9f
line 13why, one step back13// `$` is like `execa` but with script-friendly options: `{stdin: 'inherit', preferLocal: true}`Rename files (#977)ehmickybefore adoption4b2e316
lines 14–19why, one step back14const getScriptOptions = options => ({options: {...getScriptStdinOption(options), ...options}});1516const getScriptStdinOption = ({input, inputFile, stdio}) => input === undefined && inputFile === undefined && stdio === undefined17 ? {stdin: 'inherit'}18 : {};19Add more code comments (#984)ehmickybefore adoptionfdd8a9f
lines 20–21why, one step back20// When using $(...).pipe(...), most script-friendly options should apply to both commands.21// However, some options (like `stdin: 'inherit'`) would create issues with piping, i.e. cannot be deep.Rename files (#977)ehmickybefore adoption4b2e316
line 22why, one step back22export const deepScriptOptions = {preferLocal: true};