title: Why can't I execute some commands from Process?
body: <p>In python, I can execute a shell script/command by doing this.</p>
  
  <pre class="lang-py prettyprint-override"><code>import os
  
  os.system('echo hello')
  </code></pre>
  
  <p>This code will yield the expected output, <code>hello</code> from stdout, and exit code of 0. But when I try to execute commands from rust or dart, commands like <code>echo</code> and <code>ls</code> won't work.</p>
  
  <pre class="lang-rust prettyprint-override"><code>// rust
  Command::new("echo")
          .arg("hello")
          .spawn()
          .expect("echo command failed to start");
  </code></pre>
  
  <pre class="lang-dart prettyprint-override"><code>// dart
  await Process.run('echo', ['hello'])
  </code></pre>
  
  <p>Both of these will yield binary file/command not found errors. Why is that? I am simply looking for an equivalent of python's <code>system</code> function in both of these languages.</p>
  
  <p>I don't think it is because of the OS used. Because even if <code>ls</code> don't wok on windows, <code>echo</code> should. I tested both <code>dir</code> and <code>ls</code> because I was worried it is about OS, but none of them worked.</p>