-
Notifications
You must be signed in to change notification settings - Fork 127
Conversation
…to node-support
runtime.stdio.defaultStdio.writeError(String(chunk)); | ||
callback(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@facekapow why does this file contain es5 and es6 style both? looks odd. Is this okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean with the callbacks? That's because that's the way the internal API is made in Node (plus, there's really no way to Promise
that). It's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, sorry, I think I misunderstood you. The original file by @iefserge was ES5, and my additions were in ES6. It works fine, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I mean that this changes are in es6 style while the whole file is in es5. Just a note. That's ok, I suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's right :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I think it's fine, might make sense to upgrade the loader to ES6 at some point too https://github.com/runtimejs/runtime-module-loader
I was able to create a working TCP echo server using this branch: 'use strict';
const runtime = require('runtimejs');
const net = require('net');
const server = net.createServer((socket) => {
console.log('client...');
socket.on('end', () => console.log('client end...'));
socket.write('hello...\r\n');
socket.pipe(socket);
});
server.listen(9000, () => console.log('echo server online...')); |
This is awesome! I'm looking through code and going to leave my comments. 1,2. There is a https://www.npmjs.com/package/readable-stream package, that's basically node streams in userland ( |
I tried replacing
So, for now, I'm going to stick with my implementation and just work on it to support the Node API. |
@iefserge Thanks for |
@facekapow ah, you have already seen that ;) My PR might be broken. Managed to get readable-stream kinda working, there is an issue with the echo tcp server. It prints I just feel like node streams are so complex and there are so many versions of them, so it's going to be a nightmare to support own implementation. wdyt? |
Yeah, I just noticed the problem, when I tested it after committing... :{ I'm going to have to roll back that commit for now. Honestly, I think our implementation would be fine. Any issues that popup would just be fixed. I don't think it'd be such a nightmare... It's possible it might be net related (since |
9ea5bff
to
fa55ecc
Compare
@facekapow one thing I noticed is that console.log prints to the tty instead of the console. default stdio should probably print to the console too. |
Node support streams (try 2)
@facekapow I think it would be fine to split http into separate PR, so we can merge this first faster |
Sorry it took me so long to update, but I finally removed |
I'm currently working on implementing the VM module. |
@iefserge I keep getting v8::Local<v8::Value> ctx_tmp;
auto maybe_val = arg1->ToObject()->GetPrivate(context, kCtx);
maybe_val.ToLocal(&ctx_tmp);
v8::Local<v8::External> ext = ctx_tmp.As<v8::External>();
v8::Local<v8::Context> ctx = static_cast(v8::Local<v8::Context>)(ext->Value()); // I keep getting the error here
// ext->Value() by itself is okay, it must be something to do with the v8::Local<v8::Context> Any idea why this is happening? I've tried everything. |
@facekapow hmm, let's chat on gitter |
OK |
I think these are all the modules I'm gonna add for now. @iefserge If you want to add anymore, let me know. Otherwise, can this merge? |
…d process.termout and process.termerr
Apart from making |
Could you be able to explain this a bit more? |
results.push({hostname: host, record: 'CNAME', name: readHostname(reader).join('.')}); | ||
break; | ||
case queries.MX: | ||
console.log(reader.readUint8()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@facekapow debug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I forgot.
@facekapow looks like console.log outputs extra |
@piranna there are two consoles
|
…cess.termerr, remove debug console.log
@iefserge About the |
How is that they are not the same?
|
@piranna The QEMU serial port console is the one that outputs to your system terminal. The graphical console is the one created by runtime.js in the QEMU window. |
I understand the difference, but I don't understand why there are different... Maybe I'm too much used to deal with QEmu and Linux where you get one or the other... |
graphical console has a command prompt, useful for debugging. |
@@ -290,13 +290,17 @@ | |||
const stream = loader.require('stream'); | |||
class StdoutStream extends stream.Writable { | |||
_write(chunk, encoding, callback) { | |||
__SYSCALL.log(String(chunk)); | |||
var out = String(chunk); | |||
if (out.substring(out.length-1) === '\n') out = out.substring(0, out.length-1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I think this is an issue with __SYSCALL.log
, it shouldn't add \n
at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, but if you remove the newline from __SYSCALL.log
, the output at startup is output on the same line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a __SYSCALL.write
?
There's only one little thing. Should I add a |
Two consoles would be pretty confusing, I think graphical one is more like a debug tool. Should be fine as it is. |
Ok. |
Any last minute bugs or anything? |
@facekapow this looks great, very exciting! Tests coverage would be cool, but there are still a few issues with the test runner, so I'd say it's fine to merge now 👍 |
Bump kernel and JS versions? |
@facekapow not yet, I'm looking into Travis CI based automatic deployment, because prebuilt binaries need to be released too |
Deleted my last comment, it was completely wrong, sorry. |
@facekapow yeah, I think using releases would be fine. |
Oh, ok. Guess I wasn't completely wrong.
|
@facekapow this has been released 👍 |
@iefserge Great! edit: nevermind, you already did. |
Adds a lot more support for node. Specifically:
dns.js
(basic, only A records),console.js
,process.stdout
,process.stderr
,stream.js
. Couple of notes:stream.js
myself becausestream-browserify
kept crapping out and throwingReferenceError
s everywhere.stream.js
: I have to implementstream.Transform
.stream.js
: I had to copy-paste forstream.Duplex
since it inherits bothstream.Readable
andstream.Writable
(if anyone knows how to do multiple inheritance in ES6, please let me know how).