summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMustansir Golawala <mgolawala@gmail.com>2012-04-12 01:29:15 -0700
committerBen Noordhuis <info@bnoordhuis.nl>2012-04-14 23:17:38 +0200
commit7ee15457edbd634c85b69fb3b865c4e27b17b672 (patch)
tree15b8d53adc9e933671335ddea0e530e94f244c43
parent93cefab1a3a40a5693217c9ce43380a1e1cfad4e (diff)
downloadandroid-node-v8-7ee15457edbd634c85b69fb3b865c4e27b17b672.tar.gz
android-node-v8-7ee15457edbd634c85b69fb3b865c4e27b17b672.tar.bz2
android-node-v8-7ee15457edbd634c85b69fb3b865c4e27b17b672.zip
os: add cross platform EOL character
-rw-r--r--doc/api/os.markdown3
-rw-r--r--lib/os.js2
-rw-r--r--test/simple/test-os.js3
3 files changed, 8 insertions, 0 deletions
diff --git a/doc/api/os.markdown b/doc/api/os.markdown
index 0a8a17fd39..33eb9b6317 100644
--- a/doc/api/os.markdown
+++ b/doc/api/os.markdown
@@ -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.
diff --git a/lib/os.js b/lib/os.js
index 8bd421b087..c21971c84b 100644
--- a/lib/os.js
+++ b/lib/os.js
@@ -42,3 +42,5 @@ exports.getNetworkInterfaces = function() {
};
module.deprecate('getNetworkInterfaces',
'It is now called `os.networkInterfaces`.');
+
+exports.EOL = process.platform === 'win32' ? '\r\n' : '\n';
diff --git a/test/simple/test-os.js b/test/simple/test-os.js
index 92d1a264c1..a70142f9f7 100644
--- a/test/simple/test-os.js
+++ b/test/simple/test-os.js
@@ -79,3 +79,6 @@ switch (platform) {
assert.deepEqual(actual, expected);
break;
}
+
+var EOL = os.EOL;
+assert.ok(EOL.length > 0);