SajidZakaria's blog

By SajidZakaria, history, 6 weeks ago, In English

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

 
 
 
 
  • Vote: I like it
  • +33
  • Vote: I do not like it

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

    • »
      »
      »
      6 weeks ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      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 .

      • »
        »
        »
        »
        6 weeks ago, # ^ |
        Rev. 3   Vote: I like it 0 Vote: I do not like it

        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.

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

:D

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

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.

  • »
    »
    6 weeks ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    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.

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I wanted to give and receive the I/O from the console. Is that not possible with this setup?

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

teamviewer e setup dis

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

:D