internal void Start(string commandText) { _command = _remoteSystem.Shell.ExecuteCommandAsynchronously(commandText, Timeout.Infinite); _command.Finished += (sender, e) => _callback.OnExit(((NonHostedCommand)sender).ExitCode.ToString()); _command.OutputReceived += (sender, e) => _callback.OnOutputLine(e.Output); _command.RedirectErrorOutputToOutput = true; _command.BeginOutputRead(); }
private void Close() { lock (_lock) { if (_command != null) { _command.Dispose(); _command = null; } } }
internal void Start(string commandText) { if (!_remoteSystem.IsConnected) { _remoteSystem.Connect(_remoteSystem.ConnectionInfo); } if (_remoteSystem.IsConnected) { _command = _remoteSystem.Shell.ExecuteCommandAsynchronously(commandText, Timeout.Infinite); _command.Finished += (sender, e) => _callback.OnExit(((NonHostedCommand)sender).ExitCode.ToString(CultureInfo.InvariantCulture)); _command.OutputReceived += (sender, e) => _callback.OnOutputLine(e.Output); _command.RedirectErrorOutputToOutput = true; _command.BeginOutputRead(); } else { Debug.Fail("Remote System not connected."); } }