Skip to content

Release v3.27.4

Compare
Choose a tag to compare
@oleg-shilo oleg-shilo released this 21 Aug 02:16
· 660 commits to master since this release

Continuation of the CLI/Mono/VSCode related effort started with v3.27.0.

  • Fixed flawed boolean logic that got activated as the result of the new "scripted arg" support.
  • Removed '-nl' (no logo) option. Printing logo is suppressed now by default for all CLI scenarios except help, version and 'no args'.
  • Added typical Linux CLI double-dash prefix for help and version.
  • Added support for 'scripted args' ("cscs -update" where "-update" is a script file).
  • Enabled setting CS-Script runtime environment variables on Linux.
  • Reviewed and refined concurrency support on Linux:
    • mutex cleanup and prompt release
    • ensuring assembly file is opened for reading during inmem loading
  • Further improvements for issue #82.

CS-Script now allows defining CLI custom arguments as a script. The sample below demonstrates how to create -log argument that creates Start/End entries in the EventLog for every script executed with the -log argument.

CLI:

cscs -log text.cs

EventLog
image

Content of the -log file:

using System;
using System.Linq;
using System.Reflection;
using System.Diagnostics;

class Script
{
    static public void Main(string[] args)
    {
        string args_text = string.Join(" ", args);

        using (var eventLog = new EventLog("Application"))
        {
            eventLog.Source = "Application";
            eventLog.WriteEntry("CS-Script execution start: '" + args_text + "'", EventLogEntryType.Information, 101, 1);
            try
            {
                if (args.Any())
                {
                    var engine = Assembly.GetEntryAssembly() ??
                                 Assembly.LoadFrom(Environment.GetEnvironmentVariable("CSScriptRuntimeLocation"));

                    engine.EntryPoint.Invoke(null, new object[] { args });
                }
            }
            finally
            {
                eventLog.WriteEntry("CS-Script execution end.", EventLogEntryType.Information, 101, 1);
            }
        }
    }
}