Process.cpp

Test case - Zbigniew Rebacz, 07/19/2014 01:27 PM

Download (561 Bytes)

 
1
#include <Core/Core.h>
2

    
3
using namespace Upp;
4

    
5
void startApp(LocalProcess& process) {
6
        #ifdef PLATFORM_POSIX
7
                process.Start("/usr/bin/xterm");
8
        #endif
9
        #ifdef PLATFORM_WIN32
10
                process.Start("E:\\Programy\\Notepad++\\notepad++.exe");
11
        #endif
12
}
13

    
14
CONSOLE_APP_MAIN {
15
        for (int i = 0; i < 1; i++) {
16
                // Test if "WaitForExit" works.
17
                LocalProcess myProcess;
18
                startApp(myProcess);
19
                myProcess.WaitForExit();
20
                
21
                // Test if we can reuse the same instance of LocalProcces for new task.
22
                startApp(myProcess);
23
                myProcess.WaitForExit();
24
        }
25
}