JohnEarnest / ok

An open-source interpreter for the K5 programming language.
MIT License
587 stars 72 forks source link

Reading from stdin doesn't quite work correctly #48

Closed refi64 closed 8 years ago

refi64 commented 8 years ago

This is what happens when I run nodejs repl.js:

ryan@DevPC-LX:~/stuff/ok$ nodejs repl.js
oK v0.1

  fs.js:651
  var r = binding.read(fd, buffer, offset, length, position);
                  ^

Error: EAGAIN: resource temporarily unavailable, read
    at Error (native)
    at Object.fs.readSync (fs.js:651:19)
    at readchar (/media/ryan/stuff/ok/repl.js:15:5)
    at readline (/media/ryan/stuff/ok/repl.js:19:34)
    at Object.<anonymous> (/media/ryan/stuff/ok/repl.js:46:14)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
ryan@DevPC-LX:~/stuff/ok$ 

A quick Google found this, which mentioned that Node's stream interfaces are "still in flux". Maybe you should just use readline?

refi64 commented 8 years ago

Actually, this has been fixed already. Wrong branch!