buildfoundation / mainframer

Tool for remote builds. Sync project to remote machine, execute command, sync back.
Apache License 2.0
1.73k stars 162 forks source link

Interactive SSH session as an option. #224

Open artem-zinnatullin opened 6 years ago

artem-zinnatullin commented 6 years ago

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?

bmc08gt commented 6 years ago

-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.

artem-zinnatullin commented 6 years ago

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

bmc08gt commented 6 years ago

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

artem-zinnatullin commented 6 years ago

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?

Pozzoooo commented 6 years ago

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

artem-zinnatullin commented 6 years ago

@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 commented 6 years ago

@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

Pozzoooo commented 6 years ago

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

artem-zinnatullin commented 6 years ago

Fair 👍

artem-zinnatullin commented 6 years ago

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

MVMS1994 commented 5 years ago

+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

cococolanosugar commented 4 years ago

+1 for this enhancement.