how to stop a command in the VS Code terminal

后端 未结 11 1008
天命终不由人
天命终不由人 2021-02-06 22:48

I\'ve been stopping commands with the trash can for too long. Command period doesn\'t work on Mac. I can\'t find anywhere how to stop the terminal via a command. Anyone know wha

相关标签:
11条回答
  • 2021-02-06 23:42

    many of mac users (inclusive me) get mix with cmd and ctrl button. But ctrl+c should work fine.

    0 讨论(0)
  • 2021-02-06 23:46

    You can kinda bypass the issue by writing, system("pause"), at the very end of your main function. That works for me like a charm...

    0 讨论(0)
  • 2021-02-06 23:53

    If you are on linux, open the shortcuts:

    Then type kill, this option will appear.

    Double-click on the record, choose a shortcut for it, then open the terminal, ctrl + j, then press the shortcut you chose.

    The difference in pressing ctrl+j and then ctrl+j again to close, is that it will not keep the terminal process, but only close it.

    0 讨论(0)
  • 2021-02-06 23:55

    In certain cases, such as running a Node server, Ctrl-C wouldn't work. Instead, you can stop the app or command by pressing Ctrl+Alt+M (i.e. Ctrl+Option+M for mac users).

    Sample JavaScript code to demonstrate this:

    const http = require('http');
    
    http.createServer((req, res) => {
        res.write('Hello, world!');
        res.end();
    }).listen(5000, () => console.log('Server running...'));
    
    0 讨论(0)
  • 2021-02-06 23:55

    In VSCode first hit following
    ctrl + c
    It will ask following question;
    Terminate batch job (Y/N)?
    Press Y + Enter
    After this run following command on the prompt;
    D:\Testing>exit + Enter

    It will stop the instance.

    0 讨论(0)
提交回复
热议问题