| 50 | ); |
| 51 | } else if (type == "zsh") { |
| 52 | const runScript = (script: string): Promise<string> => { |
| 53 | const shellScript = `response="${response.trim().replaceAll('"', '\\"').replaceAll("\n", "\\n")}" |
| 54 | prompt="${prompt.trim().replaceAll('"', '\\"').replaceAll("\n", "\\n")}" |
| 55 | input="${input.trim().replaceAll('"', '\\"').replaceAll("\n", "\\n")}" |
| 56 | ${script.replaceAll("\n", " && ")}`; |
| 57 | |
| 58 | return new Promise((resolve, reject) => { |
| 59 | PLApplicator.bulkApply(shellScript, { customPlaceholders, defaultPlaceholders: PromptLabPlaceholders }).then( |
| 60 | (subbedScript) => { |
| 61 | exec(subbedScript, (error, stdout) => { |
| 62 | if (error) { |
| 63 | reject(error); |
| 64 | return; |
| 65 | } |
| 66 | resolve(stdout); |
| 67 | }); |
| 68 | }, |
| 69 | ); |
| 70 | }); |
| 71 | }; |
| 72 | await runScript(script); |
| 73 | } |
| 74 | } catch (error) { |