Allow inherited EDITOR and PAGER env vars in @drupal-canvas/create
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3584906. --> Reported by: [balintbrews](https://www.drupal.org/user/613760) Related to !919 >>> <h3 id="overview">Overview</h3> <p>The <code>@drupal-canvas/create</code> CLI can fail in interactive terminals when inherited <code>EDITOR</code> or <code>PAGER</code> environment variables are present.</p> <p>In the failing case, the command prints the template/app summary and then exits with <code>Error: Use of "EDITOR" is not permitted without enabling allowUnsafeEditor</code> or <code>Error: Use of "PAGER" is not permitted without enabling allowUnsafePager</code>.</p> <p>This is caused by newer <code>simple-git</code> releases, which use <code>@simple-git/argv-parser</code> to reject those inherited environment variables unless they are explicitly allowed. <code>npx</code> makes this easier to hit because it injects <code>EDITOR=vi</code> even when the shell does not export <code>EDITOR</code>, while shells that export <code>PAGER</code> trigger the pager variant.</p> <p>To reproduce, use the attached <code>Dockerfile</code> placed inside a directory named <code>repro</code>:</p> <pre><pre>docker build -t canvas-create-repro packages/create/repro<br>docker run --rm -it -e REPRO_MODE=editor canvas-create-repro<br>docker run --rm -it -e REPRO_MODE=pager canvas-create-repro</pre></pre><h3 id="proposed-resolution">Proposed resolution</h3> <p>Update the <code>simple-git</code> wrapper in <code>packages/create/src/lib/use-git.ts</code> to create the client with <code>unsafe.allowUnsafeEditor</code> and <code>unsafe.allowUnsafePager</code> enabled, while continuing to set <code>GIT_TERMINAL_PROMPT=0</code> for git prompt suppression.</p> <p>Allowing those flags is safe in this CLI because the git usage is narrowly scripted: the create flow only runs <code>clone</code>, <code>fetch</code>, <code>checkout</code>, <code>init</code>, <code>add</code>, and <code>commit</code>, and the <code>commit</code> call already supplies an explicit commit message instead of launching an editor. In this case the rejected variables are inherited process environment, not user-supplied git arguments, so enabling these two <code>unsafe</code> options removes a false positive without expanding the command surface used by the scaffolding flow.</p> <h3 id="ui-changes">User interface changes</h3> <p>n/a</p>
issue