SajidZakaria's blog

By SajidZakaria, 22 months ago,

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

 » 22 months ago, # |   0 Thanks a lot for this , I recently shifted to windows from ubuntu , I was really looking for something like this .
•  » » 22 months ago, # ^ |   0 Welcome and thanks. Do let me know if you face any issues while installing the script.
•  » » » 22 months ago, # ^ | ← 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 .
•  » » » » 22 months ago, # ^ | ← 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.
•  » » 6 weeks ago, # ^ |   0 I just shifted to ubuntu from windows , any reason why you left ubuntu ?
 » 22 months ago, # |   0 :D
 » 22 months ago, # |   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.
•  » » 22 months ago, # ^ | ← 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.
•  » » » 22 months ago, # ^ |   0 I wanted to give and receive the I/O from the console. Is that not possible with this setup?
 » 22 months ago, # | ← Rev. 2 →   0 teamviewer e setup dis
 » 22 months ago, # |   0 :D
 » 20 months ago, # |   +3 Thank you so much! Having recently switched from ubuntu to windows, this has been a life saver.
•  » » 20 months ago, # ^ |   0 My pleasure ^_^
 » 15 months ago, # |   0 Auto comment: topic has been updated by SajidZakaria (previous revision, new revision, compare).
 » 6 weeks ago, # |   0 Thanks! Was looking for this since a while.
 » 4 weeks ago, # |   -10 thanks a lot. I was looking for this thing and this is just amazing.