Блог пользователя SajidZakaria

Автор SajidZakaria, 4 года назад, По-английски

UPD: Script significantly improved. If you're using it, please considering updating, instructions on the given repo

So I am using Sublime Text in Linux as my CP Environment. But I've always wondered whether it was possible to use terminal features (like timeout and -head) in Windows in the same way. I tried hard with CMD but it was too weak to do these. So I tried with Powershell. It was a long journey and after spending many hours I finally got it to do exactly what I wanted. I'll just copy paste the features of this build here.

Features of this build:

  1. Uses File I/O.
  2. Has a timeout feature, terminates process after hitting timeout.
  3. Has an output size limit, terminates program when the output generated is out of control.
  4. Terminates immediately after a runtime error occurs. (Normally Windows takes a lot longer)
  5. Easily customizable.

As far as I've tested this build felt very consistent. I also did the last Round #677 Div3 with this and I really didn't feel like I was using windows instead of linux. I know it's not a big deal, but if anyone ever wanted to have things like these and didn't find any other solution, you might want to have a go at this.

You can find the Build System here : https://github.com/SajidZakaria/ST3-CP-Environment

  • Проголосовать: нравится
  • +33
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Thanks a lot for this , I recently shifted to windows from ubuntu , I was really looking for something like this .

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Welcome and thanks. Do let me know if you face any issues while installing the script.

    • »
      »
      »
      4 года назад, # ^ |
      Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

      Actually I'm facing This issue I I followed all the Instructions in readme ! I even Changed the Set the execution policy to remotesigned . But it's showing the error D:\CP\ST3-CP-Environment-master\Script.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:3 + & 'D:/CP/ST3-CP-Environment-master/Script.ps1' -file 'D:\CP\program.c ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess I checked multiple times it says the path was correct .

      • »
        »
        »
        »
        4 года назад, # ^ |
        Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

        Well I tried this in several PCs and none had this problem. This was not supposed to happen. Did you open powershell as administrator? If not set execution policy again as administrator, hopefully it will work.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

dude can you help me out, please. I don't have any experience of using anything other than vscode where everything happens at once. I was able to follow all the steps mentioned in your github post and my cpp files are building perfectly. What we do after this? I will have to open the exe file from the cmd or is there any other way, I'm pretty lost rn.

  • »
    »
    4 года назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    The script compiles and runs the exe file. How do you want to use it? Do you want I/O from files? If so I'd suggest you to go with Sublime Text. Otherwise if you want to use the console in vscode for input and output, the script needs to be changed a bit.

»
4 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Thank you so much! Having recently switched from ubuntu to windows, this has been a life saver.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by SajidZakaria (previous revision, new revision, compare).