Sublime Forum

Terminus auto_close does not work

#1

I installed the terminus to allow my c code to get input from the terminal. The terminus_exec works fine, but if I use terminus_open, followed by auto_close false, the shell that opens takes the input from terminal, executes the program, but then exits, so I can not see the results. terminus_exec does not have that problem because the console stays open at the bottom. What am I doing wrong. Here is my build file, and a test c program I am running.
Build file:
{
“target”: “terminus_open”,
“shell_cmd” : “gcc ${file_name} -o ${file_base_name} && ${file_path}/${file_base_name}”,
“auto_close”: “false”,
“selector” : “source.c”,
“working_dir” : “$file_path”
}

and a simple c code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const argv[])
{
int i, j;
fprintf(stdout, “please input an integer\n”);
fscanf(stdin, “%d”,&i),
j = i
i;
printf("%d, %d\n", i, j);
char *s = “Execution Complete\n”;
printf("%s\n",s );
return 0;
}

0 Likes

#2

I was able to keep the terminal open by a trick, modifying the command slightly, by adding bash to keep it open, see below.

“shell_cmd” : “gcc ${file_name} -o ${file_base_name} && ${file_path}/${file_base_name};bash”,

But my main question still remains, why does “auto_close” “false” does not work?

0 Likes

#3

The reason this doesn’t work is that auto_close is a boolean setting that takes the value true or false. In your build system you set it to a string (i.e. the false is wrapped in double quotes, "false").

Removing the double quotes on the value should solve the problem for you

1 Like

#4

Thank you OdatNurd. That was it, I took out quoutes, and it worked fine. I really appreciate your response, and your very helpful videos about terminus on your youtube channel.

Kind Regards,
BJ

2 Likes