Macvim: How to stop exceptions errors to terminal?

Created on 22 Nov 2016  路  4Comments  路  Source: macvim-dev/macvim

I am using Sierra and MacVim 8.0 (116).

I can't pinpoint exactly when this started happening, but I get tons of exceptions dumped to terminal now. What's weird is ... I start mvim from terminal, which then returns the cursor to my terminal (it doesn't take over where you need to push Ctrl-C).

After working for some time, I will look and there will be a MacVim error, except it will be 'active' and using my terminal, where I need to push Ctrl+C

I've never known a way that a process can suddenly take over a terminal without issuing a command...?

Here's a few of them. They don't seem to bother vim so id maybe like to hide them somehow

2016-11-22 11:38:46.774 MacVim[12139:190040] IMKInputSession presentFunctionRowItemTextInputViewWithEndpoint:completionHandler: : *NO* NSRemoteViewController to client, NSError=Error Domain=NSCocoaErrorDomain Code=4099 "The connection from pid 0 was invalidated from this process." UserInfo={NSDebugDescription=The connection from pid 0 was invalidated from this process.}, com.apple.inputmethod.EmojiFunctionRowItem

and

2016-11-22 11:33:46.594 Vim[11997:187099] *** -[NSMachPort handlePortMessage:]: dropping incoming DO message because the connection is invalid
2016-11-22 11:33:46.598 Vim[11997:187099] *** Terminating app due to uncaught exception 'NSInvalidReceivePortException', reason: 'connection is invalid'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fffcda4d48b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00007fffe234ccad objc_exception_throw + 48
    2   CoreFoundation                      0x00007fffcdacb96d +[NSException raise:format:] + 205
    3   Foundation                          0x00007fffcf4353dc -[NSConnection sendInvocation:internal:] + 241
    4   CoreFoundation                      0x00007fffcd9bf94a ___forwarding___ + 538
    5   CoreFoundation                      0x00007fffcd9bf6a8 _CF_forwarding_prep_0 + 120
    6   Foundation                          0x00007fffcf434433 -[NSConnection rootProxy] + 68
    7   Vim                                 0x000000010dba3c54 -[MMBackend serverList] + 84
    8   Vim                                 0x000000010db9d92a serverGetVimNames + 41
    9   Vim                                 0x000000010da59b1c f_serverlist + 14
    10  Vim                                 0x000000010da51396 call_internal_func + 98
    11  Vim                                 0x000000010db8413d call_func + 904
    12  Vim                                 0x000000010db83d01 get_func_tv + 485
    13  Vim                                 0x000000010da508f6 eval7 + 1060
    14  Vim                                 0x000000010da502a4 eval6 + 44
    15  Vim                                 0x000000010da4ff5d eval5 + 53
    16  Vim                                 0x000000010da4f737 eval4 + 48
    17  Vim                                 0x000000010da4f5f4 eval3 + 39
    18  Vim                                 0x000000010da46320 eval1 + 38
    19  Vim                                 0x000000010db83be5 get_func_tv + 201
    20  Vim                                 0x000000010da508f6 eval7 + 1060
    21  Vim                                 0x000000010da502a4 eval6 + 44
    22  Vim                                 0x000000010da4ff5d eval5 + 53
    23  Vim                                 0x000000010da4f737 eval4 + 48
    24  Vim                                 0x000000010da4f5f4 eval3 + 39
    25  Vim                                 0x000000010da46320 eval1 + 38
    26  Vim                                 0x000000010db83be5 get_func_tv + 201
    27  Vim                                 0x000000010da508f6 eval7 + 1060
    28  Vim                                 0x000000010da502a4 eval6 + 44
    29  Vim                                 0x000000010da4ff5d eval5 + 53
    30  Vim                                 0x000000010da4f737 eval4 + 48
    31  Vim                                 0x000000010da4f69b eval3 + 206
    32  Vim                                 0x000000010da46320 eval1 + 38
    33  Vim                                 0x000000010da507a0 eval7 + 718
    34  Vim                                 0x000000010da502a4 eval6 + 44
    35  Vim                                 0x000000010da4ff5d eval5 + 53
    36  Vim                                 0x000000010da4f737 eval4 + 48
    37  Vim                                 0x000000010da4f69b eval3 + 206
    38  Vim                                 0x000000010da46320 eval1 + 38
    39  Vim                                 0x000000010da45fdd eval0 + 49
    40  Vim                                 0x000000010da45d0c eval_to_bool + 48
    41  Vim                                 0x000000010da83216 ex_if + 154
    42  Vim                                 0x000000010da73cd8 do_cmdline + 6287
    43  Vim                                 0x000000010db84ad7 call_func + 3362
    44  Vim                                 0x000000010db83d01 get_func_tv + 485
    45  Vim                                 0x000000010db87f89 ex_call + 481
    46  Vim                                 0x000000010da73cd8 do_cmdline + 6287
    47  Vim                                 0x000000010da9e782 apply_autocmds_group + 1381
    48  Vim                                 0x000000010da979f6 apply_autocmds + 33
    49  Vim                                 0x000000010dbcdcc6 getout + 332
    50  Vim                                 0x000000010dba8026 -[MMBackend(Private) connectionDidDie:] + 357
    51  CoreFoundation                      0x00007fffcd9d959c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
    52  CoreFoundation                      0x00007fffcd9d949b _CFXRegistrationPost + 427
    53  CoreFoundation                      0x00007fffcd9d9202 ___CFXNotificationPost_block_invoke + 50
    54  CoreFoundation                      0x00007fffcd996903 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1827
    55  CoreFoundation                      0x00007fffcd99593c _CFXNotificationPost + 604
    56  Foundation                          0x00007fffcf3a50e3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
    57  Foundation                          0x00007fffcf4d2e45 -[NSConnection invalidate] + 523
    58  CoreFoundation                      0x00007fffcd9d959c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
    59  CoreFoundation                      0x00007fffcd9d949b _CFXRegistrationPost + 427
    60  CoreFoundation                      0x00007fffcd9d9202 ___CFXNotificationPost_block_invoke + 50
    61  CoreFoundation                      0x00007fffcd996903 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1827
    62  CoreFoundation                      0x00007fffcd99593c _CFXNotificationPost + 604
    63  Foundation                          0x00007fffcf3a50e3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
    64  Foundation                          0x00007fffcf462715 _NSPortDeathNotify + 76
    65  CoreFoundation                      0x00007fffcda28c85 ____CFMachPortChecker_block_invoke + 69
    66  libdispatch.dylib                   0x00007fffe2bfdf5f _dispatch_call_block_and_release + 12
    67  libdispatch.dylib                   0x00007fffe2bf5128 _dispatch_client_callout + 8
    68  libdispatch.dylib                   0x00007fffe2c02bb3 _dispatch_main_queue_callback_4CF + 925
    69  CoreFoundation                      0x00007fffcda02be9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    70  CoreFoundation                      0x00007fffcd9c400d __CFRunLoopRun + 2205
    71  CoreFoundation                      0x00007fffcd9c3514 CFRunLoopRunSpecific + 420
    72  Vim                                 0x000000010dba081a -[MMBackend waitForInput:] + 109
    73  Vim                                 0x000000010db99e91 gui_mch_wait_for_chars + 88
    74  Vim                                 0x000000010db96580 gui_wait_for_chars_or_timer + 144
    75  Vim                                 0x000000010db9649d gui_wait_for_chars + 103
    76  Vim                                 0x000000010db7be3e ui_inchar + 227
    77  Vim                                 0x000000010daa4304 inchar + 452
    78  Vim                                 0x000000010daa73a0 vgetorpeek + 4640
    79  Vim                                 0x000000010daa5d84 vgetc + 213
    80  Vim                                 0x000000010daa76ef safe_vgetc + 9
    81  Vim                                 0x000000010dadc459 normal_cmd + 331
    82  Vim                                 0x000000010dbce288 main_loop + 1248
    83  Vim                                 0x000000010dbcdb0c vim_main2 + 4230
    84  Vim                                 0x000000010dbcc39d main + 6885
    85  libdyld.dylib                       0x00007fffe2c2b255 start + 1
    86  ???                                 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Vim: Caught deadly signal ABRT
Vim: Finished.

Most helpful comment

The same issue was also reported to MacPorts: https://trac.macports.org/ticket/53838

Such a wrapper script is not a good solution, as it hides any startup errors and might leave users clueless about problems. Nevertheless, if upstream decides this is the correct way to tackle this problem, then this should be done in the mvim wrapper script as shipped with MacVim.

All 4 comments

Some UNIX 101:

When you launch mvim it backgrounds itself. Its STDOUT and STDERR and still tied to your terminal session. Thus, when it errors, it writes the error the relevant file handle, thus displaying the error in your terminal.

You don't need to press cntrl-c. You can press enter and get your prompt back if you really want to see it. Otherwise, you can continue to do whatever you are doing. The error output has no bearing on your STDIN file handle (which is what is used to read what you type).

If you really don't care about MacVim errors, you can write a quick script to hide this every time.

#/bin/bash

exec mvim $@ > /dev/null 2>&1

exit $?

Let's say you stored that as ~/mvim_noout.sh, you could then create an alias in your .bashrc file to call this script instead of mvim when you type mvim. Or, you can call it mvim and place it in a folder in your home directory and prepend that folder to your $PATH in your .bashrc.

Awesome!! Thanks so much, thats amazing 馃憤 I appreciate the great answer.

I'm glad I could help! I did however forgot to mention something; don't forget to:

chmod +x <the script>

So that it can be executed!

The same issue was also reported to MacPorts: https://trac.macports.org/ticket/53838

Such a wrapper script is not a good solution, as it hides any startup errors and might leave users clueless about problems. Nevertheless, if upstream decides this is the correct way to tackle this problem, then this should be done in the mvim wrapper script as shipped with MacVim.

Was this page helpful?
0 / 5 - 0 ratings