Ejemplo n.º 1
0
        public override IAsyncExecutionResult startExecutableAsyncInteractively(string cmdExe, string args, string workingDir = null)
        {
            IAsyncExecutionResult toRet = null;

            while (toRet == null)
            {
                toRet = executor.startExecutableAsyncInteractively(cmdExe, args, workingDir);
            }
            return(toRet);
        }
Ejemplo n.º 2
0
        public IAsyncExecutionResult startExecutableAsyncWithRetry(string toExec, string args, string workingDir)
        {
            IAsyncExecutionResult asyncRes = null;

            while (asyncRes == null)
            {
                asyncRes = startExecutableAsync(toExec, args, workingDir);
            }
            return(asyncRes);
        }
Ejemplo n.º 3
0
        public virtual executionResult startExecutable(string toExecute, string args, string workingDir = null, cancellableDateTime deadline = null)
        {
            if (deadline == null)
            {
                deadline = new cancellableDateTime(TimeSpan.FromMinutes(3));
            }

            IAsyncExecutionResult resultInProgress = null;

            try
            {
                while (resultInProgress == null)
                {
                    resultInProgress = startExecutableAsync(toExecute, args, workingDir);
//	FIXME!!!
//     This is causing an awful assembly load failure when it throws :/
//     Disabling the timeout for now because I am waaay behind schedule already
//                if (DateTime.Now > deadline)
//                    throw new hypervisorExecutionException();
                    deadline.doCancellableSleep(TimeSpan.FromSeconds(3));
                }

                while (true)
                {
                    deadline.doCancellableSleep(TimeSpan.FromSeconds(3));

                    executionResult res = resultInProgress.getResultIfComplete();

                    if (res != null)
                    {
                        return(res);
                    }
                }
            }
            finally
            {
                if (resultInProgress != null)
                {
                    resultInProgress.Dispose();
                }
            }
        }
Ejemplo n.º 4
0
        public static void doExecTestAsync(clientExecutionMethod exec)
        {
            using (hypervisor_vmware hyp = machinePools.vmware.createHypervisorForNextFreeVMOrWait(execType: exec))
            {
                prepVM(hyp);
                IAsyncExecutionResult asyncRes = null;
                while (asyncRes == null)
                {
                    asyncRes = hyp.startExecutableAsync("cmd.exe", "/c choice /t 5 /d y >nul & echo This is a test&echo and stderr 1>&2 & exit /b 1234");
                }

                executionResult res = null;
                while (res == null)
                {
                    res = asyncRes.getResultIfComplete();
                    Thread.Sleep(TimeSpan.FromSeconds(1));
                }

                Assert.AreEqual("This is a test\r\n", res.stdout);
                Assert.AreEqual("and stderr  \r\n", res.stderr);
                Assert.AreEqual(1234, res.resultCode);
            }
        }