Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
os: add cross platform EOL character
Browse files Browse the repository at this point in the history
  • Loading branch information
mgolawala authored and bnoordhuis committed Apr 14, 2012
1 parent 93cefab commit 7ee1545
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/api/os.markdown
Expand Up @@ -129,3 +129,6 @@ Get a list of network interfaces:
vmnet8: [ { address: '10.88.88.1', family: 'IPv4', internal: false } ],
ppp0: [ { address: '10.2.0.231', family: 'IPv4', internal: false } ] }

## os.EOL

A constant defining the appropriate End-of-line marker for the operating system.
2 changes: 2 additions & 0 deletions lib/os.js
Expand Up @@ -42,3 +42,5 @@ exports.getNetworkInterfaces = function() {
};
module.deprecate('getNetworkInterfaces',
'It is now called `os.networkInterfaces`.');

exports.EOL = process.platform === 'win32' ? '\r\n' : '\n';
3 changes: 3 additions & 0 deletions test/simple/test-os.js
Expand Up @@ -79,3 +79,6 @@ switch (platform) {
assert.deepEqual(actual, expected);
break;
}

var EOL = os.EOL;
assert.ok(EOL.length > 0);

0 comments on commit 7ee1545

Please sign in to comment.