blob: 06fe44981905cbdd4b74a24a3dd8f52dd3476ff3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#include "ptyqt.h"
#include <utility>
#ifdef Q_OS_WIN
#include "winptyprocess.h"
#include "conptyprocess.h"
#endif
#ifdef Q_OS_UNIX
#include "unixptyprocess.h"
#endif
bool PtyQt::isUsingConPTY()
{
#ifdef Q_OS_WIN
if (ConPtyProcess::isAvailable() && qgetenv("QTC_USE_WINPTY").isEmpty())
return true;
#endif
return false;
}
IPtyProcess *PtyQt::createPtyProcess(IPtyProcess::PtyType ptyType)
{
switch (ptyType)
{
#ifdef Q_OS_WIN
case IPtyProcess::PtyType::WinPty:
return new WinPtyProcess();
break;
case IPtyProcess::PtyType::ConPty:
return new ConPtyProcess();
break;
#endif
#ifdef Q_OS_UNIX
case IPtyProcess::PtyType::UnixPty:
return new UnixPtyProcess();
break;
#endif
case IPtyProcess::PtyType::AutoPty:
default:
break;
}
#ifdef Q_OS_WIN
if (isUsingConPTY())
return new ConPtyProcess();
else
return new WinPtyProcess();
#endif
#ifdef Q_OS_UNIX
return new UnixPtyProcess();
#endif
}
|