<h3 dir="auto">Is there an existing issue for this?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the existing issues</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">New lines in arguments supplied to <code class="notranslate">npx</code> are replaced with \n when reading via process.argv</p>
<p dir="auto">So "<br>
" becomes "\n". This behaviour is not reproducible if running a bin script directly in the command line (<code class="notranslate">./bin.js "$ARG"</code> and not <code class="notranslate">npx package-with-bin "$ARG"</code>)</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">New lines in process.argv args to be represented as "<br>
"</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>bin.js:</li>
</ol>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#!/usr/bin/env node
const value = process.argv[2];
console.log(value);"><pre class="notranslate">#!/usr/bin/env node
<span class="pl-k">const</span> <span class="pl-s1">value</span> <span class="pl-c1">=</span> <span class="pl-s1">process</span><span class="pl-kos">.</span><span class="pl-c1">argv</span><span class="pl-kos">[</span><span class="pl-c1">2</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">value</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<ol start="2" dir="auto">
<li>package.json:</li>
</ol>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  &quot;bin&quot; : {
    &quot;package-with-bin&quot;: &quot;./bin.js&quot;
  },"><pre class="notranslate"><code class="notranslate">  "bin" : {
    "package-with-bin": "./bin.js"
  },
</code></pre></div>
<ol start="2" dir="auto">
<li>npm publish</li>
<li>create a file with multiple lines</li>
<li></li>
</ol>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="npx package-with-bin &quot;$(cat multilinefile)&quot;"><pre class="notranslate">npx package-with-bin <span class="pl-s"><span class="pl-pds">"</span><span class="pl-s"><span class="pl-pds">$(</span>cat multilinefile<span class="pl-pds">)</span></span><span class="pl-pds">"</span></span></pre></div>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>OS: macOS Big Sur 11.3.1</li>
<li>Node: v15.12.0</li>
<li>npm: 7.8.0</li>
</ul>
<h3 dir="auto">Brief</h3>
<p dir="auto"><code class="notranslate">npx</code> and <code class="notranslate">npm exec</code>  pass <em>ESCAPED</em> multiline string, instead of original string.</p>
<h3 dir="auto">Is there an existing issue for this?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the existing issues</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<div class="highlight highlight-text-adblock notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ npx cowsay -- &quot;$(node --version; npm --version)&quot;
 __________________
&lt; v14.16.0\n7.15.0 &gt;
 ------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||"><pre class="notranslate"><span class="pl-k">$</span> npx cowsay -- "<span class="pl-ii">$</span>(node --version; npm --version)"
 __________________
&lt; v14.16.0\n7.15.0 &gt;
 ------------------
        \   <span class="pl-k">^</span>__<span class="pl-k">^</span>
         \  (oo)\_______
            (__)\       )\/\
                ||----w <span class="pl-k">|</span>
                ||     |<span class="pl-k">|</span></pre></div>
<h3 dir="auto">Expected Behavior</h3>
<div class="highlight highlight-text-adblock notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="cowsay &quot;$(node --version; npm --version)&quot;    
 __________
/ v14.16.0 \
\ 7.15.0   /
 ----------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||"><pre class="notranslate">cowsay "<span class="pl-k">$</span>(node --version; npm --version)"    
 __________
/ v14.16.0 \
\ 7.15.0   /
 ----------
        \   <span class="pl-k">^</span>__<span class="pl-k">^</span>
         \  (oo)\_______
            (__)\       )\/\
                ||----w <span class="pl-k">|</span>
                ||     |<span class="pl-k">|</span></pre></div>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li><code class="notranslate">docker run -it node /bin/bash</code></li>
<li><code class="notranslate">npx cowsay "$(node --version; npm --version)"</code></li>
</ol>
<h3 dir="auto">Environment</h3>
<p dir="auto">Docker: node</p>
<ul dir="auto">
<li>OS:  Debian GNU/Linux 9 (stretch)</li>
<li>Node: v15.14.0 - v17.4.0</li>
<li>npm: 7.7.6 - 8.3.1</li>
</ul>