@@ -71,6 +71,7 @@ public static void main(String[] args) {
71
71
private boolean noSite = false ;
72
72
private boolean stdinIsInteractive = System .console () != null ;
73
73
private boolean runLLI = false ;
74
+ private boolean unbufferedIO = false ;
74
75
private VersionAction versionAction = VersionAction .None ;
75
76
private String sulongLibraryPath = null ;
76
77
private List <String > givenArguments ;
@@ -184,8 +185,7 @@ protected List<String> preprocessArguments(List<String> givenArgs, Map<String, S
184
185
inputArgs .remove ("-compile-truffle-immediately" );
185
186
break ;
186
187
case "-u" :
187
- // TODO we currently don't support this option, but needs to be consumed
188
- // due pip/wheel installer.
188
+ unbufferedIO = true ;
189
189
break ;
190
190
default :
191
191
if (!arg .startsWith ("-" )) {
@@ -340,6 +340,7 @@ protected void launch(Builder contextBuilder) {
340
340
inspectFlag = inspectFlag || System .getenv ("PYTHONINSPECT" ) != null ;
341
341
noUserSite = noUserSite || System .getenv ("PYTHONNOUSERSITE" ) != null ;
342
342
verboseFlag = verboseFlag || System .getenv ("PYTHONVERBOSE" ) != null ;
343
+ unbufferedIO = unbufferedIO || System .getenv ("PYTHONUNBUFFERED" ) != null ;
343
344
}
344
345
345
346
// The unlikely separator is used because options need to be strings. See
@@ -359,6 +360,7 @@ protected void launch(Builder contextBuilder) {
359
360
contextBuilder .option ("python.NoUserSiteFlag" , Boolean .toString (noUserSite ));
360
361
contextBuilder .option ("python.NoSiteFlag" , Boolean .toString (noSite ));
361
362
contextBuilder .option ("python.IgnoreEnvironmentFlag" , Boolean .toString (ignoreEnv ));
363
+ contextBuilder .option ("python.UnbufferedIO" , Boolean .toString (unbufferedIO ));
362
364
363
365
sulongLibraryPath = System .getenv ("SULONG_LIBRARY_PATH" );
364
366
if (sulongLibraryPath != null ) {
@@ -513,8 +515,7 @@ protected void printHelp(OptionCategory maxCategory) {
513
515
"-S : don't imply 'import site' on initialization\n " +
514
516
// "-t : issue warnings about inconsistent tab usage (-tt: issue errors)\n"
515
517
// +
516
- // "-u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x\n" +
517
- // " see man page for details on internal buffering relating to '-u'\n" +
518
+ "-u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x\n " +
518
519
"-v : verbose (trace import statements); also PYTHONVERBOSE=x\n " +
519
520
" can be supplied multiple times to increase verbosity\n " +
520
521
"-V : print the Python version number and exit (also --version)\n " +
0 commit comments