@@ -218,6 +218,14 @@ void CompilerClient::SyntaxCheck() {
218
218
callData->start ();
219
219
}
220
220
221
+ void CompilerClient::TearDown () {
222
+ auto * callData = ScheduleTask<AsyncResponseReadWorker<Empty>>();
223
+
224
+ auto worker = dynamic_cast <AsyncResponseReadWorker<Empty>*>(callData);
225
+ worker->stream = stub->PrepareAsyncTeardown (&worker->context , ::buffers::Empty (), &cq);
226
+ callData->start ();
227
+ }
228
+
221
229
template <typename T>
222
230
T* CompilerClient::ScheduleTask () {
223
231
auto callData = new T ();
@@ -243,7 +251,7 @@ void CompilerClient::UpdateLoop(void* got_tag, bool ok) {
243
251
ServerPlugin::ServerPlugin (MainWindow& mainWindow) : RGMPlugin(mainWindow) {
244
252
// create a new child process for us to launch an emake server
245
253
process = new QProcess (this );
246
-
254
+
247
255
connect (process, &QProcess::errorOccurred, [&](QProcess::ProcessError error) {
248
256
qDebug () << " QProcess error: " << error << endl;
249
257
});
@@ -253,7 +261,7 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
253
261
connect (process, &QProcess::readyReadStandardError, [&]() {
254
262
emit LogOutput (process->readAllStandardError ());
255
263
});
256
-
264
+
257
265
#ifdef _WIN32
258
266
// TODO: Make all this stuff configurable in IDE
259
267
QProcessEnvironment env = QProcessEnvironment::systemEnvironment ();
@@ -271,11 +279,11 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
271
279
272
280
// look for an executable file that looks like emake in some common directories
273
281
#ifndef RGM_DEBUG
274
- QString emakeName = " emake" ;
282
+ QString emakeName = " emake" ;
275
283
#else
276
- QString emakeName = " emake-debug" ;
284
+ QString emakeName = " emake-debug" ;
277
285
#endif
278
-
286
+
279
287
QFileInfo emakeFileInfo;
280
288
foreach (auto path, MainWindow::EnigmaSearchPaths) {
281
289
const QDir dir (path);
@@ -286,12 +294,12 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
286
294
break ;
287
295
}
288
296
}
289
-
297
+
290
298
if (emakeFileInfo.filePath ().isEmpty ()) {
291
299
qDebug () << " Error: Failed to locate emake. Compiling and syntax check will not work.\n " << " Search Paths:\n " << MainWindow::EnigmaSearchPaths;
292
300
return ;
293
301
}
294
-
302
+
295
303
if (MainWindow::EnigmaRoot.filePath ().isEmpty ()) {
296
304
qDebug () << " Error: Failed to locate ENIGMA sources. Compiling and syntax check will not work.\n " << " Search Paths:\n " << MainWindow::EnigmaSearchPaths;
297
305
return ;
@@ -308,9 +316,9 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
308
316
<< " Paths"
309
317
<< " -r"
310
318
<< " --quiet"
311
- << " --enigma-root"
319
+ << " --enigma-root"
312
320
<< MainWindow::EnigmaRoot.absolutePath ();
313
-
321
+
314
322
qDebug () << " Running: " << program << " " << arguments;
315
323
316
324
process->start (program, arguments);
@@ -330,11 +338,14 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
330
338
compilerClient->GetSystems ();
331
339
}
332
340
333
- ServerPlugin::~ServerPlugin () { process->close (); }
341
+ ServerPlugin::~ServerPlugin () {
342
+ compilerClient->TearDown ();
343
+ process->waitForFinished ();
344
+ }
334
345
335
- void ServerPlugin::Run () { compilerClient->CompileBuffer (mainWindow.Game (), CompileRequest::RUN); };
346
+ void ServerPlugin::Run () { compilerClient->CompileBuffer (mainWindow.Game (), CompileRequest::RUN); }
336
347
337
- void ServerPlugin::Debug () { compilerClient->CompileBuffer (mainWindow.Game (), CompileRequest::DEBUG); };
348
+ void ServerPlugin::Debug () { compilerClient->CompileBuffer (mainWindow.Game (), CompileRequest::DEBUG); }
338
349
339
350
void ServerPlugin::CreateExecutable () {
340
351
const QString& fileName =
0 commit comments