When autocorrecting a file in a project with bundler the command 'bundle exec rubocop' is not found. Instead of passing the 3 words as first argument to execFileSync, it has to be splitted to ['bundle', 'exec', 'rubocop']. The first is the command an the rest are options.
A fix is to change
cp.execFileSync(config.command, [tmpFileName, ...getCommandArguments(tmpFileName), '--auto-correct'], { cwd: getCurrentPath(document.fileName) });
to
const cmd = config.command.split(/\s+/) cp.execFileSync(cmd.pop(), [...cmd, tmpFileName, ...getCommandArguments(tmpFileName), '--auto-correct'], { cwd: getCurrentPath(document.fileName) } )
in file rubocop.js
When autocorrecting a file in a project with bundler the command 'bundle exec rubocop' is not found. Instead of passing the 3 words as first argument to execFileSync, it has to be splitted to ['bundle', 'exec', 'rubocop']. The first is the command an the rest are options. A fix is to change
cp.execFileSync(config.command, [tmpFileName, ...getCommandArguments(tmpFileName), '--auto-correct'], { cwd: getCurrentPath(document.fileName) });
toconst cmd = config.command.split(/\s+/) cp.execFileSync(cmd.pop(), [...cmd, tmpFileName, ...getCommandArguments(tmpFileName), '--auto-correct'], { cwd: getCurrentPath(document.fileName) } )
in file rubocop.jsFixed in #66