aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 0758ec2..cfdf823 100644
--- a/src/main.c
+++ b/src/main.c
@@ -40,6 +40,7 @@ static struct option long_options[] = {
{"config", optional_argument, 0, 'c'},
{"python", optional_argument, 0, 'p'},
{"verbose", no_argument, 0, 'v'},
+ {"unbuffered", no_argument, 0, 'U'},
{"update-base", optional_argument, 0, OPT_ALWAYS_UPDATE_BASE},
{0, 0, 0, 0},
};
@@ -51,6 +52,7 @@ const char *long_options_help[] = {
"Read configuration file",
"Override version of Python in configuration",
"Increase output verbosity",
+ "Disable line buffering",
"Update conda installation prior to OMC environment creation",
NULL,
};
@@ -145,7 +147,7 @@ int main(int argc, char *argv[], char *arge[]) {
int c;
while (1) {
int option_index;
- c = getopt_long(argc, argv, "hVCc:p:v", long_options, &option_index);
+ c = getopt_long(argc, argv, "hVCc:p:vU", long_options, &option_index);
if (c == -1) {
break;
}
@@ -168,6 +170,13 @@ int main(int argc, char *argv[], char *arge[]) {
case OPT_ALWAYS_UPDATE_BASE:
arg_always_update_base_environment = 1;
break;
+ case 'U':
+ setenv("PYTHONUNBUFFERED", "1", 1);
+ fflush(stdout);
+ fflush(stderr);
+ setvbuf(stdout, NULL, _IONBF, 0);
+ setvbuf(stderr, NULL, _IONBF, 0);
+ break;
case 'v':
globals.verbose = 1;
break;