yatli / fvim

Cross platform Neovim front-end UI, built with F# + Avalonia
MIT License
1.34k stars 30 forks source link

fvim crashes when neovim closes due to file already open #203

Closed siddhi closed 3 years ago

siddhi commented 3 years ago

I had a file open in fvim.

Opened it again in another window and got the usual message "Found a swap file, Do you want to (O)pen Read Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort"

When I select quit or abort, then neovim closes, which causes fvim to crash

Expected: fvim should close normally without a crash

Error

The neovim process exited abnormally

Stack Trace

at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1433.Invoke(String message) in D:\workspace_work\1\s\src\fsharp\FSharp.Core\printf.fs:line 1433 at FVim.model.rpc.msg_dispatch(Event _arg1) in D:\a\1\s\model.fs:line 252 at FVim.model.Start@347.Invoke(Event arg1) in D:\a\1\s\model.fs:line 347 at FSharp.Control.Reactive.ObservableModule.subscribe@1681-2.Invoke(T delegateArg0) at System.Reactive.AnonymousSafeObserver`1.OnNext(T value) in //Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs:line 43 at System.Reactive.Sink1.ForwardOnNext(TTarget value) in /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:line 49 at System.Reactive.Concurrency.ObserveOn1.Context..OnNextPosted(Object value) in //Rx.NET/Source/src/System.Reactive/Concurrency/Synchronization.ObserveOn.cs:line 117 at Avalonia.Threading.AvaloniaSynchronizationContext.<>c__DisplayClass5_0.b_0() in //src/Avalonia.Base/Threading/AvaloniaSynchronizationContext.cs:line 33 at Avalonia.Threading.JobRunner.Job.Avalonia.Threading.JobRunner.IJob.Run() in //src/Avalonia.Base/Threading/JobRunner.cs:line 166 at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in //src/Avalonia.Base/Threading/JobRunner.cs:line 37 at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in //src/Windows/Avalonia.Win32/Win32Platform.cs:line 247 at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg) at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken) in //src/Windows/Avalonia.Win32/Win32Platform.cs:line 194 at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in //src/Avalonia.Base/Threading/Dispatcher.cs:line 61 at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in //src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 126 at FVim.Program.app@118-1.Invoke(Window win) in D:\a\1\s\Program.fs:line 121 at FVim.Program.startMainWindow(FSharpFunc`2 app, ServerOptions opts_0, Boolean opts_1, Boolean opts_2) in D:\a\1\s\Program.fs:line 74 at FVim.Program.Main(String[] args) in D:\a\1\s\Program.fs:line 130

yatli commented 3 years ago

Can repro:

Exit code: 1
Exception message: neovim crashed

But I wonder if this is by-design because it's a non-zero exit code which indicates some error?

yatli commented 3 years ago

Related: https://github.com/yatli/fvim/issues/147

yatli commented 3 years ago

:help exiting

When using `:cquit` or when there was an error message Vim exits with exit
code 1.  Errors can be avoided by using `:silent!` or with `:catch`.

So exit code 1 is properly defined and not a crash.