public static string GetCommandString(MeeGoExecutionCommand cmd, string sdbOptions, Dictionary <string, string> auth)
        {
            string runtimeArgs = string.IsNullOrEmpty(cmd.RuntimeArguments)
                                ? (string.IsNullOrEmpty(sdbOptions)? "--debug" : "")
                                : cmd.RuntimeArguments;

            var sb = new StringBuilder();

            foreach (var arg in cmd.EnvironmentVariables)
            {
                sb.AppendFormat("{0}='{1}' ", arg.Key, arg.Value);
            }
            foreach (var arg in auth)
            {
                sb.AppendFormat("{0}='{1}' ", arg.Key, arg.Value);
            }
            sb.Append("mono");
            if (!string.IsNullOrEmpty(sdbOptions))
            {
                sb.AppendFormat(" --debug --debugger-agent={0}", sdbOptions);
            }

            sb.AppendFormat(" {0} '{1}' {2}", runtimeArgs, cmd.DeviceExePath, cmd.Arguments);

            return(sb.ToString());
        }
        public static SshRemoteProcess CreateProcess(MeeGoExecutionCommand cmd, string sdbOptions, MeeGoDevice device,
                                                     Dictionary <string, string> xauth,
                                                     Action <string> stdOut, Action <string> stdErr)
        {
            string exec = GetCommandString(cmd, sdbOptions, xauth);

            var ssh = new LiveSshExec(device.Address, device.Username, device.Password);

            //hacky but openssh seems to ignore signals
            Action kill = delegate {
                var killExec = new SshExec(device.Address, device.Username, device.Password);
                killExec.Connect();
                killExec.RunCommand("ps x | grep '" + cmd.DeviceExePath + "' | " +
                                    "grep -v 'grep \\'" + cmd.DeviceExePath + "\\' | awk '{ print $1 }' | xargs kill ");
                killExec.Close();
            };

            return(new SshRemoteProcess(ssh, exec, stdOut, stdErr, kill));
        }
		public MeeGoSoftDebuggerStartInfo (IPAddress address, int debugPort, MeeGoExecutionCommand cmd, MeeGoDevice device)
			: base (cmd.Name, address, debugPort)
		{
			ExecutionCommand = cmd;
			Device = device;
		}
Esempio n. 4
0
 public MeeGoSoftDebuggerStartInfo(IPAddress address, int debugPort, MeeGoExecutionCommand cmd, MeeGoDevice device)
     : base(cmd.Name, address, debugPort)
 {
     ExecutionCommand = cmd;
     Device           = device;
 }