Skip to content

Commit

Permalink
Merge pull request #1407 from hrabe/support-shimmed-ruby-versions
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Nov 23, 2023
2 parents 52418ab + 0645077 commit 294ac98
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,23 @@ export async function spawnServer(opts, killOnExit = true) {
const tmpdir = os.tmpdir();
const filepath = path.join(tmpdir, `prettier-ruby-parser-${process.pid}.txt`);

const default_options = {
env: Object.assign({}, process.env, { LANG: getLang() }),
stdio: ["ignore", "ignore", "inherit"],
detached: true
};
const options = opts.filepath
? { cwd: path.dirname(opts.filepath), ...default_options }
: default_options;

const server = spawn(
opts.rubyExecutablePath || "ruby",
[
url.fileURLToPath(new URL("./server.rb", import.meta.url)),
`--plugins=${getPlugins(opts).join(",")}`,
filepath
],
{
env: Object.assign({}, process.env, { LANG: getLang() }),
stdio: ["ignore", "ignore", "inherit"],
detached: true
}
options
);

server.unref();
Expand Down

0 comments on commit 294ac98

Please sign in to comment.