Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 636cb90

Browse files
committedNov 29, 2016
Use platform-specific newlines in log messages
1 parent 4dae0c9 commit 636cb90

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed
 

‎src/logging.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*--------------------------------------------------------*/
44

55
import fs = require('fs');
6+
import os = require('os');
67
import path = require('path');
78
import vscode = require('vscode');
89
import utils = require('./utils');
@@ -46,11 +47,11 @@ export class Logger {
4647
if (logLevel >= this.MinimumLogLevel) {
4748
// TODO: Add timestamp
4849
this.logChannel.appendLine(message);
49-
fs.appendFile(this.logFilePath, message + "\r\n");
50+
fs.appendFile(this.logFilePath, message + os.EOL);
5051

5152
additionalMessages.forEach((line) => {
5253
this.logChannel.appendLine(line);
53-
fs.appendFile(this.logFilePath, line + "\r\n");
54+
fs.appendFile(this.logFilePath, line + os.EOL);
5455
});
5556
}
5657
}

‎src/session.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class SessionManager {
131131
public stop() {
132132

133133
// Shut down existing session if there is one
134-
this.log.write("\r\n\r\nShutting down language client...");
134+
this.log.write(os.EOL + os.EOL + "Shutting down language client...");
135135

136136
if (this.sessionStatus === SessionStatus.Failed) {
137137
// Before moving further, clear out the client and process if
@@ -153,7 +153,7 @@ export class SessionManager {
153153

154154
// Kill the PowerShell process we spawned via the console
155155
if (this.powerShellProcess !== undefined) {
156-
this.log.write("\r\nTerminating PowerShell process...");
156+
this.log.write(os.EOL + "Terminating PowerShell process...");
157157
this.powerShellProcess.kill();
158158
this.powerShellProcess = undefined;
159159
}
@@ -267,7 +267,7 @@ export class SessionManager {
267267
this.powerShellProcess.on(
268268
'close',
269269
(exitCode) => {
270-
this.log.write("\r\npowershell.exe terminated with exit code: " + exitCode + "\r\n");
270+
this.log.write(os.EOL + "powershell.exe terminated with exit code: " + exitCode + os.EOL);
271271

272272
if (this.languageServerClient != undefined) {
273273
this.languageServerClient.stop();
@@ -285,7 +285,7 @@ export class SessionManager {
285285
" pid: " + this.powerShellProcess.pid,
286286
" exe: " + powerShellExePath,
287287
" bundledModulesPath: " + bundledModulesPath,
288-
" args: " + startScriptPath + ' ' + startArgs + "\r\n\r\n");
288+
" args: " + startScriptPath + ' ' + startArgs + os.EOL + os.EOL);
289289
}
290290
catch (e)
291291
{
@@ -302,7 +302,7 @@ export class SessionManager {
302302

303303
private startLanguageClient(port: number) {
304304

305-
this.log.write("Connecting to language service on port " + port + "...\r\n");
305+
this.log.write("Connecting to language service on port " + port + "..." + os.EOL);
306306

307307
try
308308
{

0 commit comments

Comments
 (0)
Please sign in to comment.