Merge pull request #4340 from GeoffreyBooth/node-deprecations

Call synchronous `fs` methods using the `Sync` variants
This commit is contained in:
Simon Lydell
2016-10-19 08:05:21 +02:00
committed by GitHub
4 changed files with 8 additions and 8 deletions

View File

@@ -136,7 +136,7 @@ task 'build:parser', 'rebuild the Jison parser (run build first)', ->
helpers.extend global, require('util')
require 'jison'
parser = require('./lib/coffee-script/grammar').parser
fs.writeFile 'lib/coffee-script/parser.js', parser.generate()
fs.writeFileSync 'lib/coffee-script/parser.js', parser.generate()
task 'build:browser', 'rebuild the merged script for inclusion in the browser', ->
code = ''

View File

@@ -125,7 +125,7 @@
readFd = fs.openSync(filename, 'r');
buffer = new Buffer(size);
fs.readSync(readFd, buffer, 0, size, stat.size - size);
fs.close(readFd);
fs.closeSync(readFd);
repl.rli.history = buffer.toString().split('\n').reverse();
if (stat.size > maxSize) {
repl.rli.history.pop();
@@ -139,12 +139,12 @@
fd = fs.openSync(filename, 'a');
repl.rli.addListener('line', function(code) {
if (code && code.length && code !== '.history' && code !== '.exit' && lastLine !== code) {
fs.write(fd, code + "\n");
fs.writeSync(fd, code + "\n");
return lastLine = code;
}
});
repl.on('exit', function() {
return fs.close(fd);
return fs.closeSync(fd);
});
return repl.commands[getCommandId(repl, 'history')] = {
help: 'Show command history',

View File

@@ -108,7 +108,7 @@ addHistory = (repl, filename, maxSize) ->
readFd = fs.openSync filename, 'r'
buffer = new Buffer(size)
fs.readSync readFd, buffer, 0, size, stat.size - size
fs.close readFd
fs.closeSync readFd
# Set the history on the interpreter
repl.rli.history = buffer.toString().split('\n').reverse()
# If the history file was truncated we should pop off a potential partial line
@@ -123,10 +123,10 @@ addHistory = (repl, filename, maxSize) ->
repl.rli.addListener 'line', (code) ->
if code and code.length and code isnt '.history' and code isnt '.exit' and lastLine isnt code
# Save the latest command in the file
fs.write fd, "#{code}\n"
fs.writeSync fd, "#{code}\n"
lastLine = code
repl.on 'exit', -> fs.close fd
repl.on 'exit', -> fs.closeSync fd
# Add a command to show the history stack
repl.commands[getCommandId(repl, 'history')] =

View File

@@ -83,7 +83,7 @@ if require?
^^
"""
finally
fs.unlink 'test/syntax-error.coffee'
fs.unlinkSync 'test/syntax-error.coffee'
test "#1096: unexpected generated tokens", ->