summaryrefslogtreecommitdiff
path: root/test/parallel/test-repl-persistent-history.js
diff options
context:
space:
mode:
authorBartosz Sosnowski <bartosz@janeasystems.com>2017-04-20 13:18:42 +0200
committerBartosz Sosnowski <bartosz@janeasystems.com>2017-04-20 13:18:42 +0200
commitbb041ea5a0c1860f9dd196eb69a69fd55f0f3675 (patch)
tree21f8a05f90583928ee7dddbfb9d592db9014484b /test/parallel/test-repl-persistent-history.js
parentf3f9dd73aab1e4f4b4d88da36ac2aa168ef2efe9 (diff)
downloadandroid-node-v8-bb041ea5a0c1860f9dd196eb69a69fd55f0f3675.tar.gz
android-node-v8-bb041ea5a0c1860f9dd196eb69a69fd55f0f3675.tar.bz2
android-node-v8-bb041ea5a0c1860f9dd196eb69a69fd55f0f3675.zip
repl: support hidden history file on Windows
On Windows when REPL history file has the hidden attribute node will fail when trying to open it in 'w' mode. This changes the mode to 'r+'. The file is guaranteed to exists because of earlier open call with 'a+'. Fixes: https://github.com/nodejs/node/issues/5261 PR-URL: https://github.com/nodejs/node/pull/12207 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-repl-persistent-history.js')
-rw-r--r--test/parallel/test-repl-persistent-history.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/parallel/test-repl-persistent-history.js b/test/parallel/test-repl-persistent-history.js
index 2b0ceac530..6d95f932cc 100644
--- a/test/parallel/test-repl-persistent-history.js
+++ b/test/parallel/test-repl-persistent-history.js
@@ -76,6 +76,8 @@ const oldHistoryPath = path.join(fixtures, 'old-repl-history-file.json');
const enoentHistoryPath = path.join(fixtures, 'enoent-repl-history-file.json');
const emptyHistoryPath = path.join(fixtures, '.empty-repl-history-file');
const defaultHistoryPath = path.join(common.tmpDir, '.node_repl_history');
+const emptyHiddenHistoryPath = path.join(fixtures,
+ '.empty-hidden-repl-history-file');
const tests = [
{
@@ -163,6 +165,19 @@ const tests = [
test: [UP],
expected: [prompt, replFailedRead, prompt, replDisabled, prompt]
},
+ {
+ before: function before() {
+ if (common.isWindows) {
+ const execSync = require('child_process').execSync;
+ execSync(`ATTRIB +H "${emptyHiddenHistoryPath}"`, (err) => {
+ assert.ifError(err);
+ });
+ }
+ },
+ env: { NODE_REPL_HISTORY: emptyHiddenHistoryPath },
+ test: [UP],
+ expected: [prompt]
+ },
{ // Make sure this is always the last test, since we change os.homedir()
before: function before() {
// Mock os.homedir() failure