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

IDE terminal doesn't handle interactive commands #16

Open
apmcpherson opened this issue Jul 5, 2016 · 13 comments
Open

IDE terminal doesn't handle interactive commands #16

apmcpherson opened this issue Jul 5, 2016 · 13 comments

Comments

@apmcpherson
Copy link
Contributor

Commands that need a yes/no response do not respond correctly on the IDE terminal. For example:

i2cdetect -r 1

This will abort for not receiving an expect Y/n response.

@apmcpherson apmcpherson added the IDE label Jul 5, 2016
@giuliomoro
Copy link
Contributor

This happens "by design". The "terminal" in the IDE is not actually a terminal and the commands are running non-interactively, which is why commands that are interactive or require a terminal misbehave.

For instance, vim or less would not work properly because they require stdin and stdout to be terminals.

In your case you can probably fix that with

yes | i2cdetect -r 1

or this may also work

printf "y\n" | i2cdetect -r 1

This probably requires a slightly more detailed entry in the wiki

@apmcpherson
Copy link
Contributor Author

We don't need any particularly fancy terminal emulation (e.g. to run the likes of emacs), but basic capability to use interactive commands would be useful for a variety of common scenarios.

For the moment, more details on the wiki would be a good idea. Long term, a different solution that enables interactive commands would be nice, but it isn't high priority since someone can always open an actual terminal if they need to.

@LBDonovan
Copy link
Contributor

I wouldn't say this happens by design, really it happens because pty.js which is a node.js pseudo-terminal module that would allow the terminal emulator to work properly does not compile on the BeagleBone. The current system runs bash as a child-process without a pseudo-terminal which is a bit of a hack.

I haven't really had a chance to look into why it doesn't build, so it's possible this can be fixed.

@giuliomoro
Copy link
Contributor

giuliomoro commented Jul 7, 2016

@LBDonovan is this the error you are getting?

$  npm install --verbose --save pty.js

npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'install',
npm verb cli   '--verbose',
npm verb cli   '--save',
npm verb cli   'pty.js' ]
npm info using [email protected]
npm info using [email protected]
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] string_decoder is also the name of a node core module.
npm verb cache add spec pty.js
npm verb addNamed pty.js@*
npm verb addNameRange registry:https://registry.npmjs.org/pty.js not in flight; fetching
npm verb request uri https://registry.npmjs.org/pty.js
npm verb request no auth needed
npm info attempt registry request try #1 at 10:14:20 GMT+0000 (UTC)
npm verb request id 2d3087a6a6179528
npm http request GET https://registry.npmjs.org/pty.js
npm info retry will retry, error on last attempt: Error: write EPROTO 3069472768:error:1006706B:elliptic curve routines:ec_GFp_simple_oct2point:point is not on curve:../deps/openssl/openssl/crypto/ec/ecp_oct.c:417:
npm info retry 3069472768:error:1408D132:SSL routines:ssl3_get_key_exchange:bad ecpoint:../deps/openssl/openssl/ssl/s3_clnt.c:1869:
npm info retry
npm info attempt registry request try #2 at 10:14:35 GMT+0000 (UTC)
npm http request GET https://registry.npmjs.org/pty.js
npm info retry will retry, error on last attempt: Error: write EPROTO 3069472768:error:1006706B:elliptic curve routines:ec_GFp_simple_oct2point:point is not on curve:../deps/openssl/openssl/crypto/ec/ecp_oct.c:417:
npm info retry 3069472768:error:1408D132:SSL routines:ssl3_get_key_exchange:bad ecpoint:../deps/openssl/openssl/ssl/s3_clnt.c:1869:
npm info retry
npm info attempt registry request try #3 at 10:15:36 GMT+0000 (UTC)
npm http request GET https://registry.npmjs.org/pty.js
npm verb stack Error: write EPROTO 3069472768:error:1006706B:elliptic curve routines:ec_GFp_simple_oct2point:point is not on curve:../deps/openssl/openssl/crypto/ec/ecp_oct.c:417:
npm verb stack 3069472768:error:1408D132:SSL routines:ssl3_get_key_exchange:bad ecpoint:../deps/openssl/openssl/ssl/s3_clnt.c:1869:
npm verb stack
npm verb stack     at exports._errnoException (util.js:949:11)
npm verb stack     at WriteWrap.afterWrite (net.js:793:14)
npm verb cwd /root/Bela/IDE
npm ERR! Linux 3.8.13xenomai-bone41
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--verbose" "--save" "pty.js"
npm ERR! node v6.1.0
npm ERR! npm  v2.7.4
npm ERR! code EPROTO
npm ERR! errno EPROTO
npm ERR! syscall write

npm ERR! write EPROTO 3069472768:error:1006706B:elliptic curve routines:ec_GFp_simple_oct2point:point is not on curve:../deps/openssl/openssl/crypto/ec/ecp_oct.c:417:
npm ERR! 3069472768:error:1408D132:SSL routines:ssl3_get_key_exchange:bad ecpoint:../deps/openssl/openssl/ssl/s3_clnt.c:1869:
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm verb exit [ 1, true ]

npm ERR! Please include the following file with any support request:
npm ERR!     /root/Bela/IDE/npm-debug.log

@LBDonovan
Copy link
Contributor

That looks a little different actually, it seems there have been quite a few commits to the pty.js repo since I last tried to do this so I might give it another go...

@giuliomoro
Copy link
Contributor

Could it not als obe to the fact that the board has an old version of npm ?

@giuliomoro
Copy link
Contributor

giuliomoro commented Jan 22, 2017

also, funny enough, if you run this on the console:

rm -rf /root/Bela/projects/tar/bela.tar && tar cvzf /root/bela.tar /root/Bela/* && mkdir -p /root/Bela/projects/tar && mv /root/bela.tar /root/Bela/projects/tar

Once it's done,

  • the prompt at the console displays the wrong folder
  • the console actually has cd'd to /root (regardless of where it was before)

@giuliomoro
Copy link
Contributor

giuliomoro commented Aug 7, 2017

Codiad ("a minimal-footprint IDE") has an extension for terminal http://market.codiad.com/. I pin this here, though most likely we want to try to compile pty.js on 4.4.x FTW

@giuliomoro
Copy link
Contributor

https://xtermjs.org/

@giuliomoro
Copy link
Contributor

yes this works on the host:

git clone https://github.com/xtermjs/xterm.js
cd xterm.js
npm install
npm run watch  # Run this in its own terminal: builds the bundle and monitor file changes
npm start  # Run this in its own terminal, starts the server

@jarmitage
Copy link
Contributor

Related issue: #503

@giuliomoro
Copy link
Contributor

It seems that xterm.js would probably be the way to go. It seems to be doing very well, actively supported and used by VSCode among many others.

@giuliomoro
Copy link
Contributor

giuliomoro commented Feb 7, 2021

so I tried xterm.js . It stil uses pty, which now builds. See here for a PoC https://github.com/giuliomoro/Bela/tree/xterm , but it requires a fair amount of extra work to:

  • make it coexists with the Bela console
  • fix css and appearance
  • expose options
  • understand what the js code does ... currently I just got whatever came bundled in xterm.js/demo/ and repurposed its transpiled js files, instead of using the typescript.

Here's the stub. https://github.com/giuliomoro/Bela/tree/xterm
preview:

Screenshot 2021-02-07 at 17 52 50

@lewiswolf

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

4 participants