Giter Club home page Giter Club logo

Comments (15)

bsamorodov avatar bsamorodov commented on June 20, 2024 1

I'm not sure what's the actual bug is, but the following patch made wandbox act as expected.

diff --git a/autoload/wandbox.vim b/autoload/wandbox.vim
index daf97c3..a08052a 100644
--- a/autoload/wandbox.vim
+++ b/autoload/wandbox.vim
@@ -420,7 +420,7 @@ function! wandbox#compile(code, compiler, options, runtime_options, stdin)
                 \ 'method' : 'POST',
                 \ 'client' : (g:wandbox#disable_python_client ? ['curl', 'wget'] : ['python', 'curl', 'wget']),
                 \ })
-    if ! response.success
+    if response.success != 0
         throw "Request has failed! Status " . response.status . ': ' . response.statusText
     endif
     return s:JSON.decode(response.content)

from wandbox-vim.

rbtnn avatar rbtnn commented on June 20, 2024 1

@rhysd ea4d294 で動くことを確認できました。ありがとうございます。

from wandbox-vim.

rhysd avatar rhysd commented on June 20, 2024

I tried it on my machine (macOS 12.11) and I could not see the error.

2018-06-14 13 22 17

This plugin is for a web service. So the service might not work for you. Could you try again now and confirm this issue still occurs?

And if you write some configuration for wandbox-vim in your vimrc, please let me know it.

from wandbox-vim.

forno avatar forno commented on June 20, 2024

Hi @rhysd

I have the same problem.
My error message is:

function wandbox#run_sync_or_async[4]..wandbox#run[4]..wandbox#compile の処理中にエラーが検出されました:
行   19:
E605: 例外が捕捉されませんでした: Request has failed! Status 0: 
function wandbox#run_sync_or_async の処理中にエラーが検出されました:
行    4:
E171: :endif がありません

I research this problem's precision with lxc.
The result says Vim8.0 or newer has this problem, maybe.

Here is my experiment result:

The common environment;
vim-package (I put wandbox-vim to .vim/pack/wandbox/start/)
commit# 71c97b1

  1. Fail: My main computer: Ubuntu 18.04 & Vim 8.1.0115
  2. Fail: Ubuntu 18.04 container: Ubuntu18.04 & Vim 8.0.1453
  3. Success: Ubuntu 16.04 container: Ubuntu 16.04 & Vim 7.4.1689 extra 8.0.0056

What do you think for this?

from wandbox-vim.

niklasnolte avatar niklasnolte commented on June 20, 2024

i can still confirm the error, no specialities in .vimrc

from wandbox-vim.

forno avatar forno commented on June 20, 2024

Additional information.

I tryed to remove if ! response.success section on function! wandbox#compile in autoload/wandbox.vim.

I see correct movement.

## clang-head
  Hello world

It say that response.content has correct moving, But response.success and response.status are not working.
I see that vital.http are broken.

wandbox-vim's vital.vim may not support vim 8.x.

from wandbox-vim.

bsamorodov avatar bsamorodov commented on June 20, 2024

I've got the same error using vim via Termux at Android.

from wandbox-vim.

rhysd avatar rhysd commented on June 20, 2024

I'm sorry for catching the comments lately. It's very weird for me that modifying !response.success to response.success != 0 solve this issue since they mean the same in this context... But if really the modification fixes this issue, I'll add it to master.

from wandbox-vim.

rhysd avatar rhysd commented on June 20, 2024

@niklasnolte @forno @bsamorodov I added the modification at 700456e. Could you try?

from wandbox-vim.

forno avatar forno commented on June 20, 2024

@rhysd
It fixes this problem in every environment.
Thank you!

from wandbox-vim.

forno avatar forno commented on June 20, 2024

hmm...

I notice broken all others command. ex)WandboxOptionList
The fix makes degradation. Commands were working before the fix.

And this is an important point.
Web.HTTP's response.success means 1 is Success, 0 is Failed.
https://github.com/vim-jp/vital.vim/blob/master/doc/vital/Web/HTTP.txt#L163-L164

So, I think...
On old (or Vim 7.x), vital.vim's Web.HTTP undefine response.success on connection failed.
However, on new (or Vim 8.x), it defines response.success to 0 on connection failed.

Here say that if ! response.success means check to be defined.
It isn't equal if response.success != 0.

I don't know what happens.

  • :Wandbox command's response.success is 0.
  • :WandboxOptionList command's response.success is 1.

What different between them?
It may API problem, I think.

from wandbox-vim.

rbtnn avatar rbtnn commented on June 20, 2024

日本語で申し訳ないですが、同じ現状っぽいので報告しておきます。

私も:Wandboxを実行して以下のエラーになってしまいました。

Error detected while processing function wandbox#run_sync_or_async[4]..wandbox#run[4]..wandbox#compile:
line   20:
E605: Exception not caught: Request has failed! Status 0: 
Error detected while processing function wandbox#run_sync_or_async:
line    4:
E171: Missing :endif
Press ENTER or type command to continue

で、以下の部分にprintfデバッグを仕込んでみたら、HTTP 200なのにsuccessが0になるケースが存在するみたいです。

function! wandbox#compile(code, compiler, options, runtime_options, stdin)
    ...
    let response = s:HTTP.request({
                \ 'url' : 'https://wandbox.org/api/compile.json',
                \ 'data' : s:JSON.encode(data),
                \ 'headers' : {'Content-type' : 'application/json'},
                \ 'method' : 'POST',
                \ 'client' : (g:wandbox#disable_python_client ? ['curl', 'wget'] : ['python', 'curl', 'wget']),
                \ })
    echo response
    ...
endfunction
{'status': 0, 'success': 0, 'header': ['HTTP/2 200 ', 'server: nginx/1.10.3 (Ubuntu)', 'date: Sat, 09 Mar 2019 13:34:56 GMT', 'content-type: application/json', 'access-control-allow-origin: *', 'x-powered
-by: CppCMS/1.0.5', 'strict-transport-security: max-age=31536000; includeSubdomains'], 'statusText': '', 'content': '{
        "compiler_error" :      "\u001B[1mprog.c:7:21: \u001B[0m\u001B[0;1;35mwarning: \u001B[0m\u001B[1mformat specifies type ''long'' but the argument has type ''int'' [-Wformat]\u001B[0m\n    printf(\"
%ld\\n\", 1);\n\u001B[0;1;32m            ~~~     ^\n\u001B[0m\u001B[0;32m            %d\n\u001B[0m1 warning generated.\n",
        "compiler_message" :    "\u001B[1mprog.c:7:21: \u001B[0m\u001B[0;1;35mwarning: \u001B[0m\u001B[1mformat specifies type ''long'' but the argument has type ''int'' [-Wformat]\u001B[0m\n    printf(\"
%ld\\n\", 1);\n\u001B[0;1;32m            ~~~     ^\n\u001B[0m\u001B[0;32m            %d\n\u001B[0m1 warning generated.\n",
        "program_message" :     "1\n",
        "program_output" :      "1\n",
        "status" :      "0"
}
'}

from wandbox-vim.

rbtnn avatar rbtnn commented on June 20, 2024

vital.Web.HTTPがHTTP/2に対応してませんね

from wandbox-vim.

rhysd avatar rhysd commented on June 20, 2024

@rbtnn 報告ありがとうございます.うーん私の手元では普通に最新で動いてるのですよね…(HTTP/1.1) HTTP/2 でないと動かないということは無いと思うのですが…

from wandbox-vim.

rhysd avatar rhysd commented on June 20, 2024

@rbtnn なにはともあれ, ea4d294 で HTTP/2 のヘッダをパースできるようにしてみました.もしまだ動かないようなら教えていただけると助かります.

from wandbox-vim.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.