Ejemplo n.º 1
0
        /// <summary>
        /// Query /proc for a list of processes
        /// </summary>
        private bool ProcFSListProcess(SystemInformation systemInformation, out string errorMessage, out List <Process> processes)
        {
            errorMessage = string.Empty;
            processes    = null;

            int    exitCode;
            string commandOutput;

            if (!ExecuteCommand(ProcFSOutputParser.CommandText, Timeout.Infinite, out commandOutput, out errorMessage, out exitCode))
            {
                errorMessage = ProcFSErrorMessage.FormatCurrentCultureWithArgs(errorMessage);
                return(false);
            }

            processes = ProcFSOutputParser.Parse(commandOutput, systemInformation);
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Query /proc for a list of processes
        /// </summary>
        private bool ProcFSListProcess(string username, out string errorMessage, out List <Process> processes)
        {
            errorMessage = string.Empty;
            processes    = null;

            int    exitCode;
            string commandOutput;

            if (!ExecuteCommand(ProcFSOutputParser.CommandText, Timeout.Infinite, false, out commandOutput, out errorMessage, out exitCode))
            {
                errorMessage = StringResources.Error_ProcFSError.FormatCurrentCultureWithArgs(errorMessage);
                return(false);
            }

            processes = ProcFSOutputParser.Parse(commandOutput, username);
            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Query /proc for a list of processes
        /// </summary>
        private bool ProcFSListProcess(string username, out string errorMessage, out List <Process> processes)
        {
            errorMessage = string.Empty;
            processes    = null;

            int    exitCode;
            string commandOutput;

            // If used accross SSH, assume host is running Linux and escape the command (specifically the '$')
            if (!ExecuteCommand(this.OuterConnection == null ? ProcFSOutputParser.CommandText : ProcFSOutputParser.EscapedCommandText, Timeout.Infinite, true, out commandOutput, out errorMessage, out exitCode))
            {
                errorMessage = StringResources.Error_ProcFSError.FormatCurrentCultureWithArgs(errorMessage);
                return(false);
            }

            processes = ProcFSOutputParser.Parse(commandOutput, username);
            return(true);
        }