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

How to read stdin from file or pipe input to rockstar program on command line in Satriani? #297

Closed
hugobuddel opened this issue Dec 10, 2021 · 3 comments · May be fixed by #298
Closed

How to read stdin from file or pipe input to rockstar program on command line in Satriani? #297

hugobuddel opened this issue Dec 10, 2021 · 3 comments · May be fixed by #298
Assignees
Labels
bug Something isn't working

Comments

@hugobuddel
Copy link

How can stdin be read from file or pipe in Satriani?

I have these two files:

$ cat parrot.rocks 
Listen to Parrot
Whisper zir

$ cat hello.txt 
hello

Now I want the parrot to say hello, but neither these work:

$ node rockstar parrot.rocks < hello.txt 
$ cat hello.txt | node rockstar parrot.rocks

Both those commands still ask for input, and while I can manually paste the contents of hello.txt into the terminal, the goal is to automate that.

I'm currently developing on rocky, where both these constructs work. However, I'm trying to resolve some inconsistencies between Satriani and rocky, and copy pasting the code into the online editor is now the bottleneck, so I'm hoping to get the command-line working.

Maybe this is standard node behavior? This is the first time for me running node command line programs. Is there some flag I need to specify?

@hugobuddel
Copy link
Author

I'm currently developing on GUIX (a GNU Linux distribution), which is a bit unusual distribution, so it could be a problem on my end. Should those commands above work?

Seems that there can be similar problems on windows: https://stackoverflow.com/questions/45890339/stdout-is-not-a-tty-using-bash-for-node-tape-tap-spec (but the suggestions there did not seem to result in anything to resolve my problem).

@dylanbeattie
Copy link
Collaborator

No, it's not a GUIX thing, it's to do with how nodeJS handles synchronous IO. Verified as a bug, although fixing it might be entertaining (yay nodeJS)... let me take a look, see if we can wrap the readlineSync stuff in a regular readline so if there's stuff already available on stdin it won't block.

@dylanbeattie dylanbeattie added the bug Something isn't working label Dec 10, 2021
@dylanbeattie dylanbeattie self-assigned this Dec 10, 2021
@dylanbeattie dylanbeattie linked a pull request Dec 10, 2021 that will close this issue
r3trofitted added a commit to r3trofitted/advent-of-code-2022 that referenced this issue Dec 1, 2022
Let's try with Ruby, since no implementation of Rockstar can reliably
read from a file yet (so sad: RockstarLang/rockstar#297)

I'm going full-on TDD and overly object-oriented, because if I cannot use
Rockstar then I might as well _act_ like a rock star: brazenly over the top
r3trofitted added a commit to r3trofitted/advent-of-code-2023 that referenced this issue Dec 1, 2023
We'll be using a patched version of Satriani for this. (The patch is
from RockstarLang/rockstar#298 because of
RockstarLang/rockstar#297)
@dylanbeattie
Copy link
Collaborator

Rockstar 2.0 will not be built on nodeJS so won't have these kinds of headaches with async IO.

@dylanbeattie dylanbeattie closed this as not planned Won't fix, can't repro, duplicate, stale Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants