node-wasi icon indicating copy to clipboard operation
node-wasi copied to clipboard

Possible TTY fix?

Open jtenner opened this issue 4 years ago • 5 comments

Fixes #18

I think this might do it. When I go into node_modules and make this change, I can quickly write to stdout like this.

Only problem is that I can't run the tests from windows because I get a couple of errors.

> [email protected] test C:\Users\jtenner\Desktop\projects\node-wasi
> node test/run.js

cant_dotdot
'rm' is not recognized as an internal or external command,
operable program or batch file.
'rm' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
fs.js:126
    throw err;
    ^

Error: ENOENT: no such file or directory, open 'C:\Users\jtenner\Desktop\projects\node-wasi\test\out/cant_dotdot.wasm'
    at Object.openSync (fs.js:447:3)
    at Object.readFileSync (fs.js:349:35)
    at Object.<anonymous> (C:\Users\jtenner\Desktop\projects\node-wasi\test\runner.js:8:16)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
    at internal/main/run_main_module.js:17:11 {
  errno: -4058,
  syscall: 'open',
  code: 'ENOENT',
  path: 'C:\\Users\\jtenner\\Desktop\\projects\\node-wasi\\test\\out/cant_dotdot.wasm'
}
assert.js:89
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

1 !== 0

    at C:\Users\jtenner\Desktop\projects\node-wasi\test\run.js:75:12
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (C:\Users\jtenner\Desktop\projects\node-wasi\test\run.js:52:7)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
    at internal/main/run_main_module.js:17:11 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: 1,
  expected: 0,
  operator: 'strictEqual'
}
npm ERR! Test failed.  See above for more details.

Do think this will work? Or should there be something else?

How can I get testing working?

Thanks for your help.

jtenner avatar Jul 16 '19 19:07 jtenner

Any news? I would really love to test tty output and input soon!

jtenner avatar Jul 22 '19 21:07 jtenner

Sorry this slipped off my radar. I have no idea if this fixes the problem. I'm not sure that the changes except for line 515 need to be there.

devsnek avatar Jul 22 '19 21:07 devsnek

Yeah don't get me wrong. I'd love to help out. Are you a part of the assemblyscript slack server? I'm happy to help submit the work needed to fix this problem. I just need guidance and help.

jtenner avatar Jul 22 '19 22:07 jtenner

i think it would probably be better to change this to store process.stdout, process.stderr, etc., internally for stdio instead of using their FDs.

devsnek avatar Jul 22 '19 22:07 devsnek

Makes sense. I'll revisit this soon.

jtenner avatar Jul 22 '19 22:07 jtenner