Skip to content

Commit

Permalink
Node 7-nightly throws deprecation warnings when calling fs non-`Syn…
Browse files Browse the repository at this point in the history
…c` functions without callbacks; but we always want the synchronous versions, so we should just call those in the first place
  • Loading branch information
GeoffreyBooth committed Oct 19, 2016
1 parent 4d3d735 commit be44ebd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down
6 changes: 3 additions & 3 deletions lib/coffee-script/repl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/repl.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')] =
Expand Down
2 changes: 1 addition & 1 deletion test/error_messages.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ if require?
^^
"""
finally
fs.unlink 'test/syntax-error.coffee'
fs.unlinkSync 'test/syntax-error.coffee'


test "#1096: unexpected generated tokens", ->
Expand Down

0 comments on commit be44ebd

Please sign in to comment.