mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 04:54:18 +00:00
Merge pull request #16941 from Chocobo1/msvc
Fix nogui compilation for Windows
This commit is contained in:
commit
c5ea6b0502
@ -32,6 +32,7 @@
|
|||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX)
|
#if defined(Q_OS_UNIX)
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
@ -210,9 +211,7 @@ int main(int argc, char *argv[])
|
|||||||
throw CommandLineParameterError(QObject::tr("You cannot use %1: qBittorrent is already running for this user.")
|
throw CommandLineParameterError(QObject::tr("You cannot use %1: qBittorrent is already running for this user.")
|
||||||
.arg(u"-d (or --daemon)"_qs));
|
.arg(u"-d (or --daemon)"_qs));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
qDebug("qBittorrent is already running for this user.");
|
|
||||||
|
|
||||||
QThread::msleep(300);
|
QThread::msleep(300);
|
||||||
app->sendParams(params.paramList());
|
app->sendParams(params.paramList());
|
||||||
@ -318,17 +317,13 @@ int main(int argc, char *argv[])
|
|||||||
void reportToUser(const char *str)
|
void reportToUser(const char *str)
|
||||||
{
|
{
|
||||||
const size_t strLen = strlen(str);
|
const size_t strLen = strlen(str);
|
||||||
#ifndef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if (write(STDERR_FILENO, str, strLen) < static_cast<ssize_t>(strLen))
|
if (_write(_fileno(stderr), str, strLen) < static_cast<int>(strLen))
|
||||||
{
|
std::ignore = _write(_fileno(stdout), str, strLen);
|
||||||
const auto dummy = write(STDOUT_FILENO, str, strLen);
|
|
||||||
#else
|
#else
|
||||||
if (_write(STDERR_FILENO, str, strLen) < static_cast<ssize_t>(strLen))
|
if (write(STDERR_FILENO, str, strLen) < static_cast<ssize_t>(strLen))
|
||||||
{
|
std::ignore = write(STDOUT_FILENO, str, strLen);
|
||||||
const auto dummy = _write(STDOUT_FILENO, str, strLen);
|
|
||||||
#endif
|
#endif
|
||||||
Q_UNUSED(dummy);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -357,8 +352,10 @@ void sigAbnormalHandler(int signum)
|
|||||||
reportToUser(msg);
|
reportToUser(msg);
|
||||||
reportToUser(sigName);
|
reportToUser(sigName);
|
||||||
reportToUser("\n");
|
reportToUser("\n");
|
||||||
|
#if !defined Q_OS_WIN
|
||||||
print_stacktrace(); // unsafe
|
print_stacktrace(); // unsafe
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined Q_OS_WIN && !defined DISABLE_GUI
|
#if defined Q_OS_WIN && !defined DISABLE_GUI
|
||||||
StacktraceDialog dlg; // unsafe
|
StacktraceDialog dlg; // unsafe
|
||||||
|
Loading…
x
Reference in New Issue
Block a user