Skip to content

Commit

Permalink
fix: posix incompatiblity in loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohe-Am committed Dec 12, 2023
1 parent 92cd571 commit f5216cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/ports/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ async function writeLoader(
`export GHJK_CLEANUP_POSIX="";`,
...Object.entries(env).map(([k, v]) =>
// NOTE: single quote the port supplied envs to avoid any embedded expansion/execution
`GHJK_CLEANUP_POSIX+="export ${k}='$${k}';";
`GHJK_CLEANUP_POSIX=$GHJK_CLEANUP_POSIX"export ${k}='$${k}';";
export ${k}='${v}';`
),
...Object.entries(pathVars).map(([k, v]) =>
// NOTE: double quote the path vars for expansion
// single quote GHJK_CLEANUP additions to avoid expansion/exec before eval
`GHJK_CLEANUP_POSIX+='${k}=$(echo "$${k}" | tr ":" "\\n" | grep -vE "^${envDir}" | tr "\\n" ":");${k}="\${${k}%:}"';
${k}="${v}:$${k}";
`GHJK_CLEANUP_POSIX=$GHJK_CLEANUP_POSIX'${k}=$(echo "$${k}" | tr ":" "\\n" | grep -vE "^${envDir}" | tr "\\n" ":");${k}="\${${k}%:}"';
export ${k}="${v}:$${k}";
`
),
].join("\n"),
Expand Down

0 comments on commit f5216cc

Please sign in to comment.