Windows port: ConPTY via ptyqt, POSIX guards
This commit is contained in:
+12
-3
@@ -84,7 +84,11 @@ Session::Session(QObject* parent) :
|
||||
|
||||
//create teletype for I/O with shell process
|
||||
_shellProcess = new Pty();
|
||||
#if !defined(Q_OS_WIN)
|
||||
ptySlaveFd = _shellProcess->pty()->slaveFd();
|
||||
#else
|
||||
ptySlaveFd = -1;
|
||||
#endif
|
||||
|
||||
//create emulation backend
|
||||
_emulation = new Vt102Emulation();
|
||||
@@ -258,11 +262,15 @@ void Session::run()
|
||||
* their computing time on any system - especially with the problem on arch linux beeing there too.
|
||||
*/
|
||||
QString exec = QString::fromLocal8Bit(QFile::encodeName(_program));
|
||||
#if defined(Q_OS_WIN)
|
||||
if (exec.isEmpty()) {
|
||||
exec = QString::fromLocal8Bit(qgetenv("COMSPEC"));
|
||||
if (exec.isEmpty())
|
||||
exec = QStringLiteral("cmd.exe");
|
||||
}
|
||||
#else
|
||||
// if 'exec' is not specified, fall back to default shell. if that
|
||||
// is not set then fall back to /bin/sh
|
||||
|
||||
// here we expect full path. If there is no fullpath let's expect it's
|
||||
// a custom shell (eg. python, etc.) available in the PATH.
|
||||
if (exec.startsWith(QLatin1Char('/')) || exec.isEmpty())
|
||||
{
|
||||
const QString defaultShell{QLatin1String("/bin/sh")};
|
||||
@@ -278,6 +286,7 @@ void Session::run()
|
||||
exec = defaultShell;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// _arguments sometimes contain ("") so isEmpty()
|
||||
// or count() does not work as expected...
|
||||
|
||||
Reference in New Issue
Block a user