Example #1
0
        public RHost(string name, IRCallbacks callbacks)
        {
            Check.ArgumentStringNullOrEmpty(nameof(name), name);

            _callbacks = callbacks;
            _name      = name;

            _fileLogWriter = FileLogWriter.InTempFolder("Microsoft.R.Host.Client" + "_" + name);
            _log           = new LinesLog(_fileLogWriter);
        }
Example #2
0
        public RHost(string name, IRCallbacks callbacks, IMessageTransport transport, CancellationTokenSource cts)
        {
            Check.ArgumentStringNullOrEmpty(nameof(name), name);

            _callbacks = callbacks;
            _transport = transport;
            _cts       = cts;

            _fileLogWriter = FileLogWriter.InTempFolder("Microsoft.R.Host.Client" + "_" + name);
            _log           = new LinesLog(_fileLogWriter);
        }
Example #3
0
        public void Logging_LinesLogTest()
        {
            IActionLinesLog log = new LinesLog(NullLogWriter.Instance);

            log.WriteAsync(MessageCategory.Error, "message1").Wait();
            log.WriteLineAsync(MessageCategory.Error, " message2").Wait();
            log.WriteFormatAsync(MessageCategory.Error, "message3 {0}\r\n", 1).Wait();
            log.WriteLineAsync(MessageCategory.Error, "message4").Wait();

            log.Content.Should().Be("message1 message2\r\nmessage3 1\r\nmessage4\r\n");
            log.Lines.Should().Equal("message1 message2", "message3 1", "message4", string.Empty);
        }
Example #4
0
        public static bool IsInstalled(string packageName, int msTimeout, string rBasePath)
        {
            string          expression = "installed.packages()";
            IActionLinesLog log        = new LinesLog(NullLogWriter.Instance);

            bool result = RCommand.ExecuteRExpression(expression, log, msTimeout, rBasePath);

            if (result)
            {
                // stdout is list of packages
                // abind "abind" "C:/Users/[USER_NAME]/Documents/R/win-library/3.2" "1.4-3"   NA
                return(FindPackageName(packageName, log.Lines));
            }

            return(false);
        }