{"action":"created","issue":{"url":"https://api.github.com/repos/neovim/neovim/issues/4746","repository_url":"https://api.github.com/repos/neovim/neovim","labels_url":"https://api.github.com/repos/neovim/neovim/issues/4746/labels{/name}","comments_url":"https://api.github.com/repos/neovim/neovim/issues/4746/comments","events_url":"https://api.github.com/repos/neovim/neovim/issues/4746/events","html_url":"https://github.com/neovim/neovim/issues/4746","id":154515146,"number":4746,"title":"jobstart() documentation unclear about recommended usage","user":{"login":"airblade","id":7265,"avatar_url":"https://avatars.githubusercontent.com/u/7265?v=3","gravatar_id":"","url":"https://api.github.com/users/airblade","html_url":"https://github.com/airblade","followers_url":"https://api.github.com/users/airblade/followers","following_url":"https://api.github.com/users/airblade/following{/other_user}","gists_url":"https://api.github.com/users/airblade/gists{/gist_id}","starred_url":"https://api.github.com/users/airblade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airblade/subscriptions","organizations_url":"https://api.github.com/users/airblade/orgs","repos_url":"https://api.github.com/users/airblade/repos","events_url":"https://api.github.com/users/airblade/events{/privacy}","received_events_url":"https://api.github.com/users/airblade/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-12T15:41:18Z","updated_at":"2016-05-12T15:51:25Z","closed_at":null,"body":"The `jobstart()` docs say:\r\n\r\n```\r\njobstart({cmd}[, {opts}])\t\t\t\t{Nvim} *jobstart()*\r\n\t\tSpawns {cmd} as a job.  If {cmd} is a |List|, it will be run\r\n\t\tdirectly.  If {cmd} is a |string|, it will be roughly \r\n\t\tequivalent to\r\n\t\t\t:call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}'], ...)\r\n \t\tNOTE: read |shell-unquoting| before constructing any lists \r\n\t\twith 'shell' or 'shellcmdflag' options.  The above call is \r\n\t\tonly written to show the idea, one needs to perform unquoting \r\n\t\tand do split taking quotes into account.\r\n```\r\n\r\nI can't tell whether I should set `{cmd}` to a list or a string.  Which is \"better\"?\r\n\r\nThe [job control usage](https://neovim.io/doc/user/job_control.html#job-control-usage) docs show examples like:\r\n\r\n```viml\r\n let job2 = jobstart(['bash', '-c', 'for i in ...[snip]'], ...)\r\n```\r\n\r\n– which suggests to me that this construction is recommended:\r\n\r\n```viml\r\n:call jobstart([&shell, &shellcmdflag, cmd], ...)\r\n```\r\n\r\nBut the NOTE in the `jobstart()` docs says, basically, that `[&shell, &shellcmdflag, cmd]` will somehow break in the face of quotes.  The problem the NOTE is talking about sounds (a) a bit tricky and (b) like it has a correct solution.  If that's so, shouldn't it be built into NeoVim?  That would be a lot safer and easier than forcing every person who calls `jobstart()` to figure out whether they need to unquote stuff and how to do it.\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/neovim/neovim/issues/comments/218800633","html_url":"https://github.com/neovim/neovim/issues/4746#issuecomment-218800633","issue_url":"https://api.github.com/repos/neovim/neovim/issues/4746","id":218800633,"user":{"login":"airblade","id":7265,"avatar_url":"https://avatars.githubusercontent.com/u/7265?v=3","gravatar_id":"","url":"https://api.github.com/users/airblade","html_url":"https://github.com/airblade","followers_url":"https://api.github.com/users/airblade/followers","following_url":"https://api.github.com/users/airblade/following{/other_user}","gists_url":"https://api.github.com/users/airblade/gists{/gist_id}","starred_url":"https://api.github.com/users/airblade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airblade/subscriptions","organizations_url":"https://api.github.com/users/airblade/orgs","repos_url":"https://api.github.com/users/airblade/repos","events_url":"https://api.github.com/users/airblade/events{/privacy}","received_events_url":"https://api.github.com/users/airblade/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T15:51:25Z","updated_at":"2016-05-12T15:51:25Z","body":"By shell-specific do you mean stuff like pipes and redirection?"}}