Skip to content

Commit

Permalink
Fix connectToSocket path passed to nvim
Browse files Browse the repository at this point in the history
When testing local socket connections in Unix there is one case when we
use a relative path (without starting w/ ./). In this case we observe
failures to connect to neovim in our CI.
  • Loading branch information
equalsraf authored and equalsraf committed Jul 2, 2022
1 parent 8a3ac03 commit 3f05de8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/tst_neovimconnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private slots:
QTest::addColumn<QString>("socketname");

QTest::newRow("relative") << "relnvimsock";
QTest::newRow("./relative") << "./relnvimsock";
QTest::newRow("absolute") << QFileInfo("absnvimsock").absoluteFilePath();
}

Expand All @@ -109,7 +110,14 @@ private slots:
QProcess p;
p.setProgram("nvim");
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("NVIM_LISTEN_ADDRESS", socketname);

auto path_info = QFileInfo(socketname);
if (path_info.isAbsolute()) {
env.insert("NVIM_LISTEN_ADDRESS", socketname);
}
else {
env.insert("NVIM_LISTEN_ADDRESS", "./" + socketname);
}
p.setProcessEnvironment(env);
p.setArguments({"--headless", "-u", "NONE"});
p.start();
Expand Down

0 comments on commit 3f05de8

Please sign in to comment.