|
12 | 12 | using Coder.Desktop.MutagenSdk.Proto.Service.Prompting;
|
13 | 13 | using Coder.Desktop.MutagenSdk.Proto.Service.Synchronization;
|
14 | 14 | using Coder.Desktop.MutagenSdk.Proto.Synchronization;
|
| 15 | +using Coder.Desktop.MutagenSdk.Proto.Synchronization.Core.Ignore; |
15 | 16 | using Coder.Desktop.MutagenSdk.Proto.Url;
|
16 | 17 | using Coder.Desktop.Vpn.Utilities;
|
17 | 18 | using Grpc.Core;
|
@@ -213,8 +214,11 @@ public async Task<SyncSessionModel> CreateSyncSession(CreateSyncSessionRequest r
|
213 | 214 | {
|
214 | 215 | Alpha = req.Alpha.MutagenUrl,
|
215 | 216 | Beta = req.Beta.MutagenUrl,
|
216 |
| - // TODO: probably should set these at some point |
217 |
| - Configuration = new Configuration(), |
| 217 | + // TODO: probably should add a configuration page for these at some point |
| 218 | + Configuration = new Configuration |
| 219 | + { |
| 220 | + IgnoreVCSMode = IgnoreVCSMode.Ignore, |
| 221 | + }, |
218 | 222 | ConfigurationAlpha = new Configuration(),
|
219 | 223 | ConfigurationBeta = new Configuration(),
|
220 | 224 | },
|
@@ -534,25 +538,43 @@ private void StartDaemonProcess()
|
534 | 538 | Directory.CreateDirectory(_mutagenDataDirectory);
|
535 | 539 | var logPath = Path.Combine(_mutagenDataDirectory, "daemon.log");
|
536 | 540 | var logStream = new StreamWriter(logPath, true);
|
537 |
| - |
538 |
| - _daemonProcess = new Process(); |
539 |
| - _daemonProcess.StartInfo.FileName = _mutagenExecutablePath; |
540 |
| - _daemonProcess.StartInfo.Arguments = "daemon run"; |
541 |
| - _daemonProcess.StartInfo.Environment.Add("MUTAGEN_DATA_DIRECTORY", _mutagenDataDirectory); |
542 |
| - // hide the console window |
543 |
| - _daemonProcess.StartInfo.CreateNoWindow = true; |
544 |
| - // shell needs to be disabled since we set the environment |
545 |
| - // https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.environment?view=net-8.0 |
546 |
| - _daemonProcess.StartInfo.UseShellExecute = false; |
547 |
| - _daemonProcess.StartInfo.RedirectStandardError = true; |
548 |
| - // TODO: log exited process |
549 |
| - // _daemonProcess.Exited += ... |
550 |
| - if (!_daemonProcess.Start()) |
551 |
| - throw new InvalidOperationException("Failed to start mutagen daemon process, Start returned false"); |
552 |
| - |
553 |
| - var writer = new LogWriter(_daemonProcess.StandardError, logStream); |
554 |
| - Task.Run(() => { _ = writer.Run(); }); |
555 |
| - _logWriter = writer; |
| 541 | + try |
| 542 | + { |
| 543 | + _daemonProcess = new Process(); |
| 544 | + _daemonProcess.StartInfo.FileName = _mutagenExecutablePath; |
| 545 | + _daemonProcess.StartInfo.Arguments = "daemon run"; |
| 546 | + _daemonProcess.StartInfo.Environment.Add("MUTAGEN_DATA_DIRECTORY", _mutagenDataDirectory); |
| 547 | + // hide the console window |
| 548 | + _daemonProcess.StartInfo.CreateNoWindow = true; |
| 549 | + // shell needs to be disabled since we set the environment |
| 550 | + // https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.environment?view=net-8.0 |
| 551 | + _daemonProcess.StartInfo.UseShellExecute = false; |
| 552 | + _daemonProcess.StartInfo.RedirectStandardError = true; |
| 553 | + // TODO: log exited process |
| 554 | + // _daemonProcess.Exited += ... |
| 555 | + if (!_daemonProcess.Start()) |
| 556 | + throw new InvalidOperationException("Failed to start mutagen daemon process, Start returned false"); |
| 557 | + |
| 558 | + var writer = new LogWriter(_daemonProcess.StandardError, logStream); |
| 559 | + Task.Run(() => { _ = writer.Run(); }); |
| 560 | + _logWriter = writer; |
| 561 | + } |
| 562 | + catch |
| 563 | + { |
| 564 | + try |
| 565 | + { |
| 566 | + _daemonProcess?.Kill(); |
| 567 | + } |
| 568 | + catch |
| 569 | + { |
| 570 | + // ignored |
| 571 | + } |
| 572 | + _daemonProcess?.Dispose(); |
| 573 | + _logWriter?.Dispose(); |
| 574 | + _daemonProcess = null; |
| 575 | + _logWriter = null; |
| 576 | + throw; |
| 577 | + } |
556 | 578 | }
|
557 | 579 |
|
558 | 580 | /// <summary>
|
|
0 commit comments