Sublime Forum

Facing Weird problem in building with custom build

#1

Recently I am facing a weird problem with ST3, I use a C++ custom build for more than 1 inputs and output and when I build by Ctrl+B, then just after the build, it shows Building -> Reloading output file and outputs get generated well too, but the problem is the ‘reloading’ log was not used to appear before and it is quite annoying because I used to detect infinite loops in my code in ST3 by seeing this reloading log but now even a normal code is showing this log and I have no clue why this is happening all of a sudden.

See the below steps for clarification. They are in order as they appear after the build-key combination.

  1. Building log appears.
  2. Output gets added to the outputf.in file.
  3. image

P.S Tried clearing the Sublime Text 3 Appdata folder for a clean install look but the error still persists.

I think I screwed up with some settings probably and am now unable to get a way out.
Any help would be appreciated. Thanks.

0 Likes

#2

What does the build system look like?

1 Like

#3

@OdatNurd Thanks for the reply.

HERE IS MY BUILD FOR C++

{
    "cmd": ["g++.exe","-std=c++17", "${file}", "-o", "${file_base_name}.exe", "&&" , 
    "${file_base_name}.exe<inputf.in>outputf.in"],
    "shell":true,
    "working_dir":"$file_path",
    "selector":"source.cpp"
}

This build system and my sublime was working fine 2 weeks back but suddenly the above-mentioned problem appeared out of nowhere.

Environment looks something like this :
image

0 Likes

#4

Build systems in Sublime just execute some external program, and nothing has changed about that in a long while.

From the looks of the build I would expect that every time you build, the program would run taking input from the inputf.in file and sending any output to the outputf.in file, both of which would be expected to be inside of the same location as the file you’re executing.

If you have the output file open, Sublime should notice that it’s changing on disk and reload it, unless you change the state of this setting (shown here with it’s default), in which case it would ask you first if you want to reload before it actually does it:

    // Always prompt before reloading a file, even if the file hasn't been
    // modified. The default behavior is to automatically reload a file if it
    // hasn't been edited. If a file has unsaved changes, a prompt will always
    // be shown.
    "always_prompt_for_file_reload": false,

The message that you’re seeing in the status bar is Sublime telling you that the reload is happening, which is also normal.

As such, it sounds like what you’re experiencing is normal behaviour. Do you normally always have the output file open while you’re running code?

0 Likes

#5

Outputf.in file is only open in the sublime environment and nowhere else.
Behaviour is not normal as it was not used to appear before.
Writing Updating all used to happen without any logs.
The problem now I am facing is that I am unable to detect infinite loops because the Reloading log was the indicator for infinite loops in my code.
In normal code, after build, only build log used to be there.

I tried adding this in my build but some different error is being shown up and code isn’t getting compiled.
Error -

__init__() got an unexpected keyword argument 'always_prompt_for_file_reload'
[cmd: ['g++.exe', '-std=c++17', 'F:\\CPPS\\q5.cpp', '-o', 'q5.exe', '&&', 
'q5.exe<inputf.in>outputf.in']]
[dir: F:\CPPS]

@OdatNurd Check environment picture for any reference in Thread #2

0 Likes

#6

Reloading files that are open when their content changes on disk is a core feature; it’s always been there. So I suspect you have something different going on if it is suddenly reloading files now when it never did before; I have no idea what that would be. I’m also not sure what infinite loops have to do with the issue; output is output whether it happens once or a hundred times a second.

It’s not a build system field; it goes in your user preferences. However if you turn it off it will have no effect (because that is the default) and if you turn it on, you will get a popup every time the file on disk changes.

0 Likes

#7

Leave the problem aside. Assume I am coding a problem solution in a coding contest and if by mistake the code gets into an infinite loop, by this, I mean, while(1) { xyz } type thing, then what happens in windows is that the sublime freezes and I used to cancel build before the freezing thing starts to happen by seeing the reloading log! Because if I failed to ‘cancel build’ too early, then I need to kill q5.exe from Task Manager :frowning: @OdatNurd
Now how do I differentiate that if there is a normal infinite loop problem that occurred or the ‘build and reloading’ problem thing that I mentioned above occured? @OdatNurd

0 Likes