title: Building C file in Sublime Text 3 and using fork();
body: <p>(running on a mac) My C.sublime-build file looks like this:</p>
  
  <pre><code>{
  "cmd" : ["gcc -Wall -g $file_name -o ${file_base_name} &amp;&amp; ./${file_base_name}"],
  "selector" : "source.c",
  "shell": true,
  "working_dir" : "$file_path"
  }
  </code></pre>
  
  <p>and I have a simple program with the following code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;unistd.h&gt;
  
  int main ( int argc, char *argv[] ) {
      printf("hi\n");
      fork();
      printf("bye\n");
  
      return 0;
  }
  </code></pre>
  
  <p>and sublime will execute it and give me</p>
  
  <pre><code>hi
  bye
  hi
  bye
  </code></pre>
  
  <p>while executing from the shell gives me the correct result,</p>
  
  <pre><code>hi
  bye
  bye
  </code></pre>
  
  <p>why is this happening?</p>