{"action":"created","issue":{"url":"https://api.github.com/repos/niosus/EasyClangComplete/issues/91","repository_url":"https://api.github.com/repos/niosus/EasyClangComplete","labels_url":"https://api.github.com/repos/niosus/EasyClangComplete/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/niosus/EasyClangComplete/issues/91/comments","events_url":"https://api.github.com/repos/niosus/EasyClangComplete/issues/91/events","html_url":"https://github.com/niosus/EasyClangComplete/issues/91","id":180272650,"number":91,"title":"Subprocess methods should be called with array of strings, not a string","user":{"login":"rchl","id":153197,"avatar_url":"https://avatars.githubusercontent.com/u/153197?v=3","gravatar_id":"","url":"https://api.github.com/users/rchl","html_url":"https://github.com/rchl","followers_url":"https://api.github.com/users/rchl/followers","following_url":"https://api.github.com/users/rchl/following{/other_user}","gists_url":"https://api.github.com/users/rchl/gists{/gist_id}","starred_url":"https://api.github.com/users/rchl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rchl/subscriptions","organizations_url":"https://api.github.com/users/rchl/orgs","repos_url":"https://api.github.com/users/rchl/repos","events_url":"https://api.github.com/users/rchl/events{/privacy}","received_events_url":"https://api.github.com/users/rchl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-30T10:35:28Z","updated_at":"2016-10-06T21:08:02Z","closed_at":null,"body":"In various places of the code the strings passed to the clang binary are passed as one string. This makes it hard to specify paths in custom `clang_flags` or other preferences that are for specifying clang arguments.\r\n\r\nFor example if you want to specify path with spaces in `clang_binary` pref you have to quote the whole string. Path like `\"c:\\\\Program Files\\\\LLVM\\\\bin\\\\clang-cl\"` will cause error in clang due to space in the path.\r\nOr if you specify `[\"-imsvcC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/INCLUDE\"]` argument in `clang_flags` then it will trigger error in clang because all `clang_flags` arguments are converted into one string and then the space in the path will cause problems. So values like that require awkward escaping which shouldn't be needed.\r\n\r\nBut in any case, the plugin should internally handle arguments as an array of strings throughout the code when calling subprocess methods. And the preferences that are for specifying command line arguments ((`std_flag_c`, `std_flag_cpp`) should take arrays not strings . Support for strings could be kept for legacy reasons but it will complicate the code a bit."},"comment":{"url":"https://api.github.com/repos/niosus/EasyClangComplete/issues/comments/252089035","html_url":"https://github.com/niosus/EasyClangComplete/issues/91#issuecomment-252089035","issue_url":"https://api.github.com/repos/niosus/EasyClangComplete/issues/91","id":252089035,"user":{"login":"rchl","id":153197,"avatar_url":"https://avatars.githubusercontent.com/u/153197?v=3","gravatar_id":"","url":"https://api.github.com/users/rchl","html_url":"https://github.com/rchl","followers_url":"https://api.github.com/users/rchl/followers","following_url":"https://api.github.com/users/rchl/following{/other_user}","gists_url":"https://api.github.com/users/rchl/gists{/gist_id}","starred_url":"https://api.github.com/users/rchl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rchl/subscriptions","organizations_url":"https://api.github.com/users/rchl/orgs","repos_url":"https://api.github.com/users/rchl/repos","events_url":"https://api.github.com/users/rchl/events{/privacy}","received_events_url":"https://api.github.com/users/rchl/received_events","type":"User","site_admin":false},"created_at":"2016-10-06T21:08:02Z","updated_at":"2016-10-06T21:08:02Z","body":"Well, the proper solution would be to handle arguments as an array of strings from start to finish (from plugin preferences to the subprocess call).\r\n\r\nOnly in case where the input is initially just one string (.clang_complete file?) you might need to do some magic. But I think even in that case you shouldn't need to do anything if you pass it onto compiler as one string because those commands are supposed to just work. But maybe when you mix it with default plugin arguments then the problems arise...\r\n\r\nI just had a brief look at what you do in the FlagsManager and it seems that you are filtering arguments to just a couple of types (-I, -D, and some other). Why not just pass everywhere from the .clang_complete command? If the commands were created for the same compiler then passing all should work just fine. But that might be a separate discussion.\r\n\r\nAlso about this:\r\n```\r\nseparate_includes (bool): if True \"-I/blah\" turns to \"-I '/blah'\"\r\n```\r\nI think the reason you have to do it is exactly because you are just passing a string. If you would parse those into an array of arguments then original format `-I/blah` should work just fine."}}
{"actor":{"display_login":"rchl"}}