Skip to content

Commit 6486a68

Browse files
committed
Avoid opening documents when no DISPLAY is present
1 parent 6fd9b62 commit 6486a68

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modules/yup_core/native/yup_Files_linux.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ static bool isFileExecutable (const String& filename)
272272

273273
static bool openDocumentExternally (const String& fileName, const String& parameters, const Array<char*>* environment = nullptr)
274274
{
275+
const bool hasDisplay = std::getenv ("DISPLAY") != nullptr && std::strlen (std::getenv ("DISPLAY")) > 0;
276+
277+
if (! hasDisplay)
278+
return false;
279+
275280
const auto cmdString = [&]
276281
{
277282
if (fileName.startsWithIgnoreCase ("file:")

0 commit comments

Comments
 (0)