Ticket #188: added_config_option_and_console_flush1552.patch

File added_config_option_and_console_flush1552.patch, 3.9 KB (added by patrik.svestka@…, 6 years ago)

Adding flush to the powershell console and adding start_sleep config item

  • smalltalk.bat

    # HG changeset patch
    # User Patrik Svestka <patrik.svestka@gmail.com>
    # Date 1519041731 -3600
    #      Mon Feb 19 13:02:11 2018 +0100
    # Branch jv
    # Node ID 9a0f13223e3964a93233ed9de11854e612ce78a0
    # Parent  808f3bb10ef4a78676ea9520fb28f8f03d4c019f
    version 1.6.3 Added new configuration option _numeric.start_sleep_in_debug for the user to adjust the refresh rate in the asynchronous mode
    Added Out.flush() and Error.Flush() so the streams are flushed
    
    diff -r 808f3bb10ef4 -r 9a0f13223e39 smalltalk.bat
    a b  
    5353:: Versions =
    5454:: ==========
    5555:: This script
    56 SET batch_script_version=1.6.1
     56SET batch_script_version=1.6.3
    5757:: Smalltalk/X
    5858SET stx_version_default=6.2.6
    5959:: Do not change following line, $STX_VERSION_DEFAULT serves
  • smalltalk.cfg

    diff -r 808f3bb10ef4 -r 9a0f13223e39 smalltalk.cfg
    a b  
    194194
    195195# error
    196196stdout_ErrorBackgroundColor=Black
    197 stdout_ErrorForegroundColor=Red
    198  No newline at end of file
     197stdout_ErrorForegroundColor=Red
     198
     199# -------------------------------------------------------------------------------------------
     200# Do not touch, unless you know what you are doing settings
     201# -------------------------------------------------------------------------------------------
     202# Sets, in milliseconds, sleep periods in powershell  while using custom StX switches
     203# 50 milliseconds was found empirically
     204#  - less than 50ms takes heavy toll on the CPU
     205#  - more than 50ms the stdout and stderror are refresh rate is quite slow
     206__numeric.start_sleep_in_debug=50
     207 No newline at end of file
  • smalltalk.ps1

    diff -r 808f3bb10ef4 -r 9a0f13223e39 smalltalk.ps1
    a b  
    2222$log_file_width = [environment]::GetEnvironmentVariable("stx.__numeric.log_file_width")
    2323
    2424
     25# Defines start-sleep periods while running custom switches
     26$start_sleep_period = [environment]::GetEnvironmentVariable("stx.__numeric.start_sleep_in_debug")
     27
     28
    2529# =======================================================
    2630# Adjust all variables to PowerShell style $true/$false =
    2731# =======================================================
     
    233237        $stx_switch,
    234238        [Parameter(Mandatory=$true)]
    235239        [String]$logging_function,
     240        [Parameter(Mandatory=$true)]
     241        [Int]$start_sleep_period,
    236242        [Parameter(Mandatory=$false)]
    237243        [String]$verb
    238244    )
     
    338344
    339345           # Starting process with no return value
    340346           [Void]$process.Start()
    341        
     347
    342348           # Begin async read events
    343349           $process.BeginOutputReadLine()
    344350           $process.BeginErrorReadLine()
    345            
     351
    346352           # loop till application exited
    347353           # used for logging into the stdout/stderr
    348354           # Note: the timeout has been tested for speed vs. process usage -> 50ms does not use CPU that much + the output is reasonably fast
    349355           while (!$process.HasExited) {
    350                Start-Sleep -Milliseconds 50
     356               [Console]::Out.Flush()
     357               [Console]::Error.Flush()
     358               Start-Sleep -Milliseconds $start_sleep_period
    351359           }
    352360           
    353361          # Can not be used as it would wait for the exit of stx executable
     
    495503            # getting rid of all the double quotes around stx switches (were added in batch file)
    496504            $stx_switch = $stx_switch -replace '"([-]+\w+)"', "`$1"
    497505           
    498             $exit_code = DebugProcessExecute -executable $executable -stx_switch $stx_switch -logging_function $logging_function
     506            $exit_code = DebugProcessExecute -executable $executable -stx_switch $stx_switch -logging_function $logging_function -start_sleep_period $start_sleep_period
    499507
    500508        } Else {
    501509            $command = @"