mainframer icon indicating copy to clipboard operation
mainframer copied to clipboard

Interactive SSH session as an option.

Open artem-zinnatullin opened this issue 6 years ago • 12 comments

Problem:

Build tools like Gradle and Buck can output build progress much nicely if run in interactive mode, ie Gradle and Buck will show interactive progress of parallel build which is much easier to look at compared to plain build log.

Solution:

To enable that properly we can pass -t option to ssh which will try to allocate pseudo-terminal thus properly setting TERM env variable so the command we're executing can detect interactive mode and react to that.

I think that should be a config and flag option.


Note that some tools allow you manually override that, ie gradle --console rich, however particularly with Gradle output gets messed up and basically freezes if underlying ssh session is not interactive.

I remember we discussed that internally, but can't remember why we decided to not add that option, @ming13 @dmitry-novikov do you remember details?

artem-zinnatullin avatar May 22 '18 00:05 artem-zinnatullin

-tt may be required as I was getting this running this from WSL (client)-> OSX (remote).

Pseudo-terminal will not be allocated because stdin is not a terminal.

adding -tt to the ssh command in the 2.1.0 script gave me back the beautiful gradle colors.

bmc08gt avatar Jun 01 '18 21:06 bmc08gt

Right, I also use -tt in my version :)

artem-zinnatullin avatar Jun 01 '18 22:06 artem-zinnatullin

:) Are you guys accepting PR's on the 2.1.X script?

bmc08gt avatar Jun 01 '18 22:06 bmc08gt

Although, looks like some escape characters slip through and break my terminal session, for example git status after running interactive Mainframer prints output with broken tabulation (everything is shifted to the right)

@bmc08gt have you noticed something like this?

artem-zinnatullin avatar Jun 01 '18 22:06 artem-zinnatullin

I've been using with interactive mode for a while now (only -t in my case) with the old bash mainframer, haven't got any issue, another advantage is Ctrl+C being sent to the remote machine

Pozzoooo avatar Jun 01 '18 22:06 Pozzoooo

@bmc08gt nope, 2.x is frozen, particularly this feature requires configuration options (not everyone might want it), so it's not just adding -tt to ssh call

artem-zinnatullin avatar Jun 01 '18 22:06 artem-zinnatullin

@Pozzoooo Ctrl + C can be supported even in non-interactive mode in 3.x, but I'm still unsure if we need to, sometimes I want to keep remote machine doing what I started even if I stop Mainframer locally

artem-zinnatullin avatar Jun 01 '18 22:06 artem-zinnatullin

for that case I would suggest "&" or Ctrl + Z.... it might be me, but I quite often remember I forgot to change something just after hitting enter to compile

Pozzoooo avatar Jun 01 '18 22:06 Pozzoooo

Fair 👍

artem-zinnatullin avatar Jun 01 '18 22:06 artem-zinnatullin

The caveat here is that in interactive mode, remote machine can start emitting escape symbols that slip through Mainframer and break Terminal state on local machine

I've had this with running Gradle, where local machine was macOS and remove was Linux.

The problem is described and discussed here: https://github.com/rust-lang-nursery/cli-wg/issues/57#issue-346366222

artem-zinnatullin avatar Oct 15 '18 06:10 artem-zinnatullin

+1 for this enhancement. I worked around to get nodejs run on the remote machine with mainframer. And to enable colors, I locally added -t

MVMS1994 avatar Nov 22 '18 04:11 MVMS1994

+1 for this enhancement.

cococolanosugar avatar Jul 15 '20 09:07 cococolanosugar