Fix excess newlines on mosh startup/shutdown.

Fixes #788.

This also works around issues with remote pty typeahead echo corrupting output
from mosh-server.
This commit is contained in:
John Hood
2016-08-14 20:29:25 -04:00
parent 70d48fbcc0
commit 39ea3d9512
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -192,7 +192,7 @@ int main( int argc, char *argv[] )
success = false;
}
printf( "\n[mosh is exiting.]\n" );
printf( "[mosh is exiting.]\n" );
free( key );
+9 -1
View File
@@ -406,7 +406,15 @@ static int run_server( const char *desired_ip, const char *desired_port,
network->set_verbose();
}
printf( "\nMOSH CONNECT %s %s\n", network->port().c_str(), network->get_key().c_str() );
/*
* If mosh-server is run on a pty, then typeahead may echo and break mosh.pl's
* detection of the MOSH CONNECT message. Print it on a new line to bodge
* around that.
*/
if ( isatty( STDIN_FILENO ) ) {
puts( "\r\n" );
}
printf( "MOSH CONNECT %s %s\n", network->port().c_str(), network->get_key().c_str() );
/* don't let signals kill us */
struct sigaction sa;