File tree Expand file tree Collapse file tree 1 file changed +19
-12
lines changed
apps/sim/app/api/function/execute Expand file tree Collapse file tree 1 file changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -739,18 +739,25 @@ export async function POST(req: NextRequest) {
739739
740740 const lang = isValidCodeLanguage ( language ) ? language : DEFAULT_CODE_LANGUAGE
741741
742- const codeResolution = resolveCodeVariables (
743- code ,
744- executionParams ,
745- envVars ,
746- blockData ,
747- blockNameMapping ,
748- blockOutputSchemas ,
749- workflowVariables ,
750- lang
751- )
752- resolvedCode = codeResolution . resolvedCode
753- const contextVariables = codeResolution . contextVariables
742+ let contextVariables : Record < string , unknown > = { }
743+ if ( lang === CodeLanguage . Shell ) {
744+ // For shell, env vars are injected as OS env vars via shellEnvs.
745+ // Replace {{VAR}} placeholders with $VAR so the shell can access them natively.
746+ resolvedCode = code . replace ( / \{ \{ ( [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * ) \} \} / g, '$$$1' )
747+ } else {
748+ const codeResolution = resolveCodeVariables (
749+ code ,
750+ executionParams ,
751+ envVars ,
752+ blockData ,
753+ blockNameMapping ,
754+ blockOutputSchemas ,
755+ workflowVariables ,
756+ lang
757+ )
758+ resolvedCode = codeResolution . resolvedCode
759+ contextVariables = codeResolution . contextVariables
760+ }
754761
755762 let jsImports = ''
756763 let jsRemainingCode = resolvedCode
You can’t perform that action at this time.
0 commit comments