title: How to close the task terminal automatically after vscode debugging
body: <p>launch.json</p>
  <pre class="lang-json prettyprint-override"><code>...
  &quot;preLaunchTask&quot;: &quot;startDebug&quot;,
  &quot;postDebugTask&quot;: &quot;closeOpenOCDTerminal&quot;
  </code></pre>
  <p>tasks.json</p>
  <pre class="lang-json prettyprint-override"><code>{
  &quot;version&quot;: &quot;2.0.0&quot;,
  &quot;tasks&quot;: [
      {
          &quot;label&quot;: &quot;startDebug&quot;,
          &quot;type&quot;: &quot;shell&quot;,
          &quot;command&quot;: &quot;make -j4; openocd -f interface/cmsis-dap.cfg -c 'transport select swd' -f target/stm32f1x.cfg&quot;,
          &quot;isBackground&quot;: true,
          &quot;problemMatcher&quot;: {
              &quot;pattern&quot;: {
                  &quot;regexp&quot;: &quot;.&quot;
              },
              &quot;background&quot;: {
                  &quot;activeOnStart&quot;: true,
                  &quot;beginsPattern&quot;: &quot;.&quot;,
                  &quot;endsPattern&quot;: &quot;.&quot;
              }
          }
      },
      {
          &quot;label&quot;: &quot;closeOpenOCDTerminal&quot;,
          &quot;type&quot;: &quot;process&quot;,
          &quot;command&quot;:[
              &quot;${command:workbench.action.tasks.terminate}&quot;,
              // &quot;${command:workbench.action.acceptSelectedQuickOpenItem}&quot; //invalid
           ]
      }
  ]
  }
  </code></pre>
  <p>The OpenOCD service does not end automatically like the make command, only depends on closing the terminal or executing Ctrl + C.
  How to automatically close the task terminal after debugging？
  Or execute Ctrl + C command automatically in the task terminal to end the Openocd service.
  The currently used closeOpenOCDTerminal method requires manual clicking on the pop-up list.</p>