Exemplo n.º 1
0
        internal void BeginExecuteAsyncCommand(string commandText, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand)
        {
            var command = new AD7UnixAsyncCommand(_remoteSystem.Shell.OpenStream(), callback);

            command.Start(commandText);
            asyncCommand = command;
        }
Exemplo n.º 2
0
        public AD7UnixAsyncShellCommand(ICommandRunner commandRunner, IDebugUnixShellCommandCallback callback, bool closeShellOnComplete)
            : base(commandRunner, callback, closeShellOnComplete)
        {
            Guid id = Guid.NewGuid();

            _beginMessage      = "Begin:{0}".FormatInvariantWithArgs(id);
            _exitMessagePrefix = "Exit:{0}-".FormatInvariantWithArgs(id);
        }
Exemplo n.º 3
0
        public AD7UnixAsyncShellCommand(ICommandRunner commandRunner, IDebugUnixShellCommandCallback callback, bool closeShellOnComplete)
            : base(commandRunner, callback, closeShellOnComplete)
        {
            Guid id = Guid.NewGuid();

            _beginMessage      = string.Format(CultureInfo.InvariantCulture, "Begin:{0}", id);
            _exitMessagePrefix = string.Format(CultureInfo.InvariantCulture, "Exit:{0}-", id);
        }
Exemplo n.º 4
0
 public AD7UnixAsyncCommand(ICommandRunner commandRunner, IDebugUnixShellCommandCallback callback, bool closeShellOnComplete)
 {
     CommandRunner                 = commandRunner;
     Callback                      = callback;
     _closeShellOnComplete         = closeShellOnComplete;
     CommandRunner.OutputReceived += OnOutputReceived;
     CommandRunner.Closed         += OnClosed;
     CommandRunner.ErrorOccured   += OnError;
 }
Exemplo n.º 5
0
        public DockerAsyncCommand(ICommandRunner runner, IDebugUnixShellCommandCallback callback)
        {
            _callback = callback;
            _runner   = runner;
            _runner.OutputReceived += OnOutputReceived;
            _runner.ErrorOccured   += OnErrorOccured;
            _runner.Closed         += OnClose;

            _runner.Start();
        }
Exemplo n.º 6
0
 public void Close()
 {
     if (_runner != null)
     {
         _runner.Dispose();
         _runner.OutputReceived -= OnOutputReceived;
         _runner.ErrorOccured   -= OnErrorOccured;
         _runner.Closed         -= OnClose;
         _runner = null;
     }
     _callback = null;
 }
Exemplo n.º 7
0
        public AD7UnixAsyncCommand(IShellStream shellStream, IDebugUnixShellCommandCallback callback)
        {
            _shellStream = shellStream;
            _callback    = callback;
            Guid id = Guid.NewGuid();

            _beginMessage                = string.Format("Begin:{0}", id);
            _exitMessagePrefix           = string.Format("Exit:{0}-", id);
            _shellStream.OutputReceived += OnOutputReceived;
            _shellStream.Closed         += OnClosed;
            _shellStream.ErrorOccured   += OnError;
        }
Exemplo n.º 8
0
        public AD7UnixAsyncCommand(IStreamingShell streamingShell, IDebugUnixShellCommandCallback callback)
        {
            _streamingShell = streamingShell;
            _callback       = callback;
            Guid id = Guid.NewGuid();

            _beginMessage                   = string.Format("Begin:{0}", id);
            _exitMessagePrefix              = string.Format("Exit:{0}-", id);
            _streamingShell.OutputReceived += OnOutputReceived;
            _streamingShell.Closed         += OnClosedOrDisconnected;
            _streamingShell.Disconnected   += OnClosedOrDisconnected;
            _streamingShell.ErrorOccured   += OnError;
        }
Exemplo n.º 9
0
        public void Close()
        {
            // If Close is called more than once, make subsequent calls a nop
            ICommandRunner runner = Interlocked.Exchange(ref _runner, null);

            if (runner != null)
            {
                runner.Dispose();
                runner.OutputReceived -= OnOutputReceived;
                runner.ErrorOccured   -= OnErrorOccured;
                runner.Closed         -= OnClose;
            }
            _callback = null;
        }
Exemplo n.º 10
0
 internal void BeginExecuteAsyncCommand(string commandText, bool runInShell, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand)
 {
     if (runInShell)
     {
         var command = new AD7UnixAsyncShellCommand(new StreamingShell(_remoteSystem), callback);
         command.Start(commandText);
         asyncCommand = command;
     }
     else
     {
         var command = new AD7UnixAsyncCommand(_remoteSystem, callback);
         command.Start(commandText);
         asyncCommand = command;
     }
 }
Exemplo n.º 11
0
 public abstract void BeginExecuteAsyncCommand(string commandText, bool runInShell, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand);
Exemplo n.º 12
0
        public override void BeginExecuteAsyncCommand(string commandText, bool runInShell, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand)
        {
            if (IsClosed)
            {
                throw new ObjectDisposedException(nameof(PipeConnection));
            }

            // Assume in the Begin Async that we are expecting raw output from the process
            var commandRunner = GetExecCommandRunner(commandText, handleRawOutput: true);

            asyncCommand = new DockerAsyncCommand(commandRunner, callback);
        }
Exemplo n.º 13
0
        /// <inheritdoc/>
        public override void BeginExecuteAsyncCommand(string commandText, bool runInShell, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand)
        {
            if (IsClosed)
            {
                throw new ObjectDisposedException(nameof(PipeConnection));
            }

            var commandRunner = GetExecCommandRunner(commandText, handleRawOutput: runInShell == false);

            asyncCommand = new PipeAsyncCommand(commandRunner, callback);
        }
Exemplo n.º 14
0
 void IDebugUnixShellPort.BeginExecuteAsyncCommand(string commandText, bool runInShell, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand)
 {
     GetConnection().BeginExecuteAsyncCommand(commandText, runInShell, callback, out asyncCommand);
 }
Exemplo n.º 15
0
 void IDebugUnixShellPort.BeginExecuteAsyncCommand(string commandText, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand)
 {
     GetConnection(ConnectionReason.Deferred).BeginExecuteAsyncCommand(commandText, callback, out asyncCommand);
 }
Exemplo n.º 16
0
 public AD7UnixAsyncCommand(IRemoteSystem remoteSystem, IDebugUnixShellCommandCallback callback)
 {
     _remoteSystem = remoteSystem;
     _callback     = callback;
 }
Exemplo n.º 17
0
 internal void BeginExecuteAsyncCommand(string commandText, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand)
 {
     var command = new AD7UnixAsyncCommand(new StreamingShell(_remoteSystem), callback);
     command.Start(commandText);
     asyncCommand = command;
 }
Exemplo n.º 18
0
        /// <inheritdoc/>
        public override void BeginExecuteAsyncCommand(string commandText, bool runInShell, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand)
        {
            if (IsClosed)
            {
                throw new ObjectDisposedException(nameof(WSLConnection));
            }

            string         args          = WSLCommandLine.GetExecCommandLineArgs(this.Name, commandText);
            ICommandRunner commandRunner = LocalCommandRunner.CreateInstance(handleRawOutput: runInShell == false, WSLCommandLine.ExePath, args);

            asyncCommand = new PipeAsyncCommand(commandRunner, callback);
        }
Exemplo n.º 19
0
 public override void BeginExecuteAsyncCommand(string commandText, bool runInShell, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand)
 {
     if (runInShell)
     {
         var command = new AD7UnixAsyncShellCommand(new SSHRemoteShell(_remoteSystem), callback, true);
         command.Start(commandText);
         asyncCommand = command;
     }
     else
     {
         var command = new SSHUnixAsyncCommand(_remoteSystem, callback);
         command.Start(commandText);
         asyncCommand = command;
     }
 }
Exemplo n.º 20
0
 void IDebugUnixShellPort.BeginExecuteAsyncCommand(string commandText, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand)
 {
     GetConnection(ConnectionReason.Deferred).BeginExecuteAsyncCommand(commandText, callback, out asyncCommand);
 }
Exemplo n.º 21
0
        public override void BeginExecuteAsyncCommand(string commandText, bool runInShell, IDebugUnixShellCommandCallback callback, out IDebugUnixShellAsyncCommand asyncCommand)
        {
            if (IsClosed)
            {
                throw new ObjectDisposedException(nameof(PipeConnection));
            }

            if (runInShell)
            {
                AD7UnixAsyncShellCommand command = new AD7UnixAsyncShellCommand(CreateShellFromSettings(TransportSettings, OuterConnection), callback, closeShellOnComplete: true);
                command.Start(commandText);

                asyncCommand = command;
            }
            else
            {
                DockerExecSettings  settings = new DockerExecSettings(_containerName, commandText, true);
                AD7UnixAsyncCommand command  = new AD7UnixAsyncCommand(CreateShellFromSettings(settings, OuterConnection, true), callback, closeShellOnComplete: true);

                asyncCommand = command;
            }
        }