if what produced an error? either of those 2 commands?I'm guessing this is so that you don't have an output file left from a previously successful run which could cause confusion? probably it would be easier to just delete the output file before calling exec.

The easiest way to do complicated things with a build (where complicated is something other than just running a single command or chain of commands in sequence) is to create an external shell script/batch file that contains the logic that you need and then execute that.

To do something like this purely in Sublime you would need a custom build system target command that is capable of waiting for the first command to finish, checking the result, then doing other things. While doable, the script version is easier and arguably more useful because you can easily use it outside of Sublime as well.

I would go for the shell/batch way but my knowledge of them is really poor, can you provide an example of a shell/batch script that does the job independetly of the platform or multiple scripts for multiple platforms. Thanks in advance

thanks @OdatNurd and @kingkeith , i figured it out and made a plugin for that Code Profiler for now it only works for python but i'm planning to include other languages in the future such as java and c++.