Skip to content

Commit 294ac98

Browse files
authored
Merge pull request #1407 from hrabe/support-shimmed-ruby-versions
2 parents 52418ab + 0645077 commit 294ac98

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/plugin.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,23 @@ export async function spawnServer(opts, killOnExit = true) {
6767
const tmpdir = os.tmpdir();
6868
const filepath = path.join(tmpdir, `prettier-ruby-parser-${process.pid}.txt`);
6969

70+
const default_options = {
71+
env: Object.assign({}, process.env, { LANG: getLang() }),
72+
stdio: ["ignore", "ignore", "inherit"],
73+
detached: true
74+
};
75+
const options = opts.filepath
76+
? { cwd: path.dirname(opts.filepath), ...default_options }
77+
: default_options;
78+
7079
const server = spawn(
7180
opts.rubyExecutablePath || "ruby",
7281
[
7382
url.fileURLToPath(new URL("./server.rb", import.meta.url)),
7483
`--plugins=${getPlugins(opts).join(",")}`,
7584
filepath
7685
],
77-
{
78-
env: Object.assign({}, process.env, { LANG: getLang() }),
79-
stdio: ["ignore", "ignore", "inherit"],
80-
detached: true
81-
}
86+
options
8287
);
8388

8489
server.unref();

0 commit comments

Comments
 (0)