import { ScriptLine, define } from "./types.js" import quote from "shell-escape" type HasInSubShell = { inSubShell: (script: ScriptLine) => ScriptLine } export const cmdInSubShell = { bash: define({ inSubShell: (script) => `echo ${quote([script])} | bash`, }), zsh: define({ inSubShell: (script) => `echo ${quote([script])} | zsh`, }), fish: define({ inSubShell: (script) => `fish -c ${quote([script])}`, }), powershell: define({ inSubShell: (script) => `echo '${script.replace(/'/g, "\\'")}' | pwsh -NoProfile`, }), }