Skip to content

Commit

Permalink
wait for the process to exit before reading error code
Browse files Browse the repository at this point in the history
  • Loading branch information
phcreery committed Sep 28, 2024
1 parent 38c7e60 commit 4ad5696
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/server/features_formatting.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ pub fn (mut ls LanguageServer) formatting(params lsp.DocumentFormattingParams) !
}
fmt_proc.run()

loglib.info('Formatting finished with code: ${fmt_proc.code}')

// read entire output until EOF
mut output := fmt_proc.stdout_slurp()
fmt_proc.wait()

loglib.info('Formatting finished with code: ${fmt_proc.code} and status ${fmt_proc.status}')

$if windows {
output = output.replace('\r\r', '\r')
Expand All @@ -36,6 +37,7 @@ pub fn (mut ls LanguageServer) formatting(params lsp.DocumentFormattingParams) !
errors := fmt_proc.stderr_slurp().trim_space()
ls.client.show_message(errors, .info)
return error('Formatting failed: ${errors}')
// return []
}


Expand Down

0 comments on commit 4ad5696

Please sign in to comment.