title: How to run complex command in node js spawn?
body: <p>I am developing a lib for docker command line in nodejs, I am still in starting face, I just tried  basic docker run command using spawn in node js - everything works fine but it's not working for complex cases like the one below.</p>
  
  <p>I want to run <code>docker run --rm -it julia:0.3.6 julia -E "[x^2 for x in 1:100]"</code> in nodejs, but I am gettting below error -   </p>
  
  <blockquote>
    <p>the input device is not a TTY</p>
  
  <pre><code>Docker Shell existed with status = 1
  </code></pre>
  </blockquote>
  
  <p>Below Code - </p>
  
  <pre><code>    const
          spawn = require('child_process').spawn,
          dockerDeamon = spawn("docker", ["run","--rm", "-it", "julia:0.3.6", "-E",   "\" [x^2 for x in 1:100]\""] );
  
      dockerDeamon.stdout.on('data', data =&gt; {
          console.log(`${data}`);
  
      });
  
      dockerDeamon.stderr.on('data', data =&gt; {
          console.log(`${data}`);
  
      });
  
      dockerDeamon.on('close', code =&gt; {
          console.log(`Docker Shell existed with status = ${code}`);
  
      });
  </code></pre>
  
  <p>Is there any better way to execute the above script ?</p>