Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please support require("system").stdin #188

Closed
fred-wang opened this issue May 31, 2014 · 9 comments
Closed

Please support require("system").stdin #188

fred-wang opened this issue May 31, 2014 · 9 comments

Comments

@fred-wang
Copy link

Just opening a feature request for stdin, which is a commonJS requirement for the system module: http://wiki.commonjs.org/wiki/System/1.0

The slimer.js documentation does not seem to mention stdin and I was enable to figure out how to access it (http://docs.slimerjs.org/current/api/system.html). require("system").stdin works for me with phantomjs.

@fatfantasma
Copy link

Any update on this? Stdin works fine when I use casperjs but when I try to use slimerjs (--engine=slimerjs) my script hangs. The script hangs on the second line below.

var system = require('system');
var stdin_string = system.stdin.readLine();

@fred-wang
Copy link
Author

So I assume we can do as in slimer.exit() and introduce a quick hack for that: use read to get the content of stdin and print it into a profile file and then make the implementation of require("system").stdin directly read from that profile file. @laurentj what do you think about that?

@masi
Copy link

masi commented Mar 29, 2015

PhantomJS implements both stdin and stderr, but has no documentation for it. At least write() and read() are available as methods.

IMHO it would also allow some Node scripts run within SlimerJS or at least ease the conversion, eg

// simple wrapper for Node modules
var process = {
stdout: system.stdout,
stderr: system.stderr,
stdin: system.stdin
}

@fentas
Copy link

fentas commented Jun 7, 2015

Phantomjs has on example of stdin/stdout/stderr
https://github.com/ariya/phantomjs/blob/master/examples/stdin-stdout-stderr.js

Would be awesome to see it in slimerjs.

@dcworldwide
Copy link

👍

I really need this to enable slimerjs to be used within a pipeline.

Will it be delivered in the next release?

@laurentj laurentj added this to the SlimerJS 0.10 milestone Aug 20, 2015
@oldmanvv
Copy link

how long is needed?

@laurentj
Copy link
Owner

It seems there is no API in the Gecko platform to read stdin....

@laurentj laurentj removed this from the SlimerJS 0.10 milestone Mar 19, 2016
@laurentj
Copy link
Owner

Found a way but it will not work under Windows..

@laurentj laurentj added this to the SlimerJS 0.10 milestone Mar 19, 2016
laurentj added a commit that referenced this issue Mar 19, 2016
@kensoh
Copy link

kensoh commented Apr 26, 2017

Hi @laurentj good day to you. May I check if you are aware of any issue with running SlimerJS system.stdin.read()? I've checked 0.10.3 documentation and the web without error reports.

When running below in a CasperJS script within a casper block, the script ends after invoking read().

var system = require('system');
var input = system.stdin.read();

When running outside of a casper block, I get the error message below and the script ends.

Error reading from stream: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIBinaryInputStream.readBytes]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://slimerjs/addon-sdk/toolkit/loader.js -> resource://slimerjs/addon-sdk/sdk/io/byte-streams.js :: ByteReader_read :: line 68" data: no]

I'm running Firefox 52.0.2, SlimerJS 0.10.3, CasperJS 1.1.4, macOS 10.12.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants