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

Support for code piped through stdin #78

Closed
franciscolourenco opened this issue Jan 19, 2016 · 11 comments
Closed

Support for code piped through stdin #78

franciscolourenco opened this issue Jan 19, 2016 · 11 comments

Comments

@franciscolourenco
Copy link

This would allow any transpiler to be used on the fly without extra files or configuration.

Examples:

  • babel app.es6 | node-iron
  • coffee -p app.coffee | node-iron
  • etc...
@franciscolourenco franciscolourenco changed the title Support for piped code through stdin Support for code piped through stdin Jan 19, 2016
@s-a s-a mentioned this issue Jan 19, 2016
@s-a
Copy link
Owner

s-a commented Jan 21, 2016

Just thought about... But how we should handle Ctrl+r code reloading?

@franciscolourenco
Copy link
Author

Not possible I guess. Other way of achieving the same is have an option to pass a command to get the code. Having the command, then you could just run the command again.

iron-node --execute 'coffee -p app.coffee'

@s-a
Copy link
Owner

s-a commented Jan 21, 2016

But I like this pipe idea 😄 Maybe we can access piped terminal commandline text to repeat the preprocess.

@franciscolourenco
Copy link
Author

The place where terminal history is saved varies depending on the shell :/

@s-a
Copy link
Owner

s-a commented Jan 21, 2016

Yes I know and it seems there is no module out there solving this...

@s-a
Copy link
Owner

s-a commented Jan 23, 2016

I succesfuly got access to stdin data at

console.log("data", chunk);

But having trouble to access stdin at the main process module.

process.stdin.on('data', function(chunk) {

I Created a test script at

"pipe-test": "echo \"var i = 0; debugger;\" | node bin/run.js",
pipe-test

May be someone can help out?

@s-a
Copy link
Owner

s-a commented Jan 25, 2016

Sorry @aristidesfl this cannot work native on Microsoft Windows. We can only ugly work around when we use a temporary file to share piped result with electron.exe. So far I cannot see super advantages instead of using a simple bash script. Unless there are strong requests to add piped stdin support I will not implement that.

@s-a s-a closed this as completed Jan 25, 2016
@s-a s-a added the wontfix label Jan 25, 2016
@franciscolourenco
Copy link
Author

It wouldn't matter how it is implemented as long as the complexity would be hidden from the user :) That way the simple "bash script" only had to be written once in node-iron in the form of pipe support.

@s-a
Copy link
Owner

s-a commented Jan 25, 2016

I want give it a try, but should we store the tempfile in the working directory? it has an impact on later required files.

@s-a s-a removed the wontfix label Jan 25, 2016
s-a added a commit that referenced this issue Jan 25, 2016
@s-a
Copy link
Owner

s-a commented Jan 25, 2016

@aristidesfl could you please test if this works for you by installing from repo?

git clone https://github.com/s-a/iron-node.git
cd iron-node
npm install -g
echo var i = 0;debugger; | iron-node

@s-a
Copy link
Owner

s-a commented Jan 25, 2016

This work fine for me. I will publish a new version in a few minutes.
image

s-a added a commit that referenced this issue Jan 25, 2016
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

2 participants