smalltalk.ps1
branchjv
changeset 1515 919fad4de40f
parent 1514 4bdcdc52e55a
child 1516 4b143ef7d138
equal deleted inserted replaced
1514:4bdcdc52e55a 1515:919fad4de40f
    12 # ===========================================================================
    12 # ===========================================================================
    13 # Reading directly from environment - due to the issues with passing quotes =
    13 # Reading directly from environment - due to the issues with passing quotes =
    14 # ===========================================================================
    14 # ===========================================================================
    15 # StX switches which are build during batch file execution $env:stx_switch;
    15 # StX switches which are build during batch file execution $env:stx_switch;
    16 $stx_switch = [environment]::GetEnvironmentVariable("stx_switch");
    16 $stx_switch = [environment]::GetEnvironmentVariable("stx_switch");
       
    17 
    17 # PowerShell version detected during batch file execution  $env:powershell_version_all_functionality;
    18 # PowerShell version detected during batch file execution  $env:powershell_version_all_functionality;
    18 $stx_powershell_version = [environment]::GetEnvironmentVariable("powershell_version_all_functionality");
    19 $stx_powershell_version = [environment]::GetEnvironmentVariable("powershell_version_all_functionality");
    19 # getting line width for the log file
    20 # getting line width for the log file
    20 $log_file_width = [environment]::GetEnvironmentVariable("stx.__numeric.log_file_width");
    21 $log_file_width = [environment]::GetEnvironmentVariable("stx.__numeric.log_file_width");
    21 
    22 
   146 function ExecuteCommand {
   147 function ExecuteCommand {
   147     param(
   148     param(
   148        $execute_command
   149        $execute_command
   149     )
   150     )
   150     try {
   151     try {
       
   152        "`n", "[INFO] Executing command: $execute_command" | PrintMessage;
   151        Invoke-Expression -Command:$execute_command
   153        Invoke-Expression -Command:$execute_command
   152        If ($lastexitcode -ne 0) {
   154        If ($lastexitcode -ne 0) {
   153            $result = $result -join "`n";
   155            $result = $result -join "`n";
   154            throw "$result `n";
   156            throw "$result `n";
   155        }
   157        }
   217 # Stdout logging =
   219 # Stdout logging =
   218 # ================
   220 # ================
   219 If ($is_logfile_locked){
   221 If ($is_logfile_locked){
   220     "`n", "[WARN] Log file $log_file in use.`n`n  !!NO LOGGING will be available for this Smalltalk/X instance!!" | PrintMessage;
   222     "`n", "[WARN] Log file $log_file in use.`n`n  !!NO LOGGING will be available for this Smalltalk/X instance!!" | PrintMessage;
   221     '[INFO] Press any key to continue ...' | PrintMessage;
   223     '[INFO] Press any key to continue ...' | PrintMessage;
   222     # waits for pressing any key
   224     # pause - waits for pressing any key
   223     $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-null;
   225     # $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") | Out-null;
   224     $logging_function = "Tee-Host | Out-null";
   226     $logging_function = "Tee-Host | Out-null";
   225 } Else {
   227 } Else {
   226     If ($append_to_log) {
   228     If ($append_to_log) {
   227         $logging_function = "Tee-Host | Out-File -Append -Encoding $log_file_encoding -FilePath $log_file -Width $log_file_width";
   229         $logging_function = "Tee-Host | Out-File -Append -Encoding $log_file_encoding -FilePath $log_file -Width $log_file_width";
   228     } Else {
   230     } Else {