title: VSCode API: Run a command in a terminal and use output
body: <p>I'm currently building a VSCode extension that launches a shell command in a terminal. What I'd like to do is get the output as a string, but failing that I'd like to just display the output (or keep the terminal open).</p>
  
  <p>I can get the terminal open and have it run using the following code:</p>
  
  <pre class="lang-js prettyprint-override"><code>
  let terminal = vscode.window.createTerminal({
      name: "My Command",
      cwd: cwd,
      hideFromUser: false,
      shellPath: script,
      shellArgs: args,
  });
  terminal.show()
  </code></pre>
  
  <p>This works great, the command runs and I can see the output in the terminal at the bottom, but it closes immediately when the command completes. Is there a way I can have the terminal remain open, or grab the command output somehow? I've been digging through the docs but there doesn't appear to be anything.</p>