File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,7 +67,14 @@ 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 currentFile = opts . filepath || process . cwd ( ) ;
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 ;
7178
7279 const server = spawn (
7380 opts . rubyExecutablePath || "ruby" ,
@@ -76,12 +83,7 @@ export async function spawnServer(opts, killOnExit = true) {
7683 `--plugins=${ getPlugins ( opts ) . join ( "," ) } ` ,
7784 filepath
7885 ] ,
79- {
80- cwd : path . dirname ( currentFile ) ,
81- env : Object . assign ( { } , process . env , { LANG : getLang ( ) } ) ,
82- stdio : [ "ignore" , "ignore" , "inherit" ] ,
83- detached : true
84- }
86+ options ,
8587 ) ;
8688
8789 server . unref ( ) ;
You can’t perform that action at this time.
0 commit comments