Remove 'terminal_chdir' code

Code previously added did not work as intended, so removed as it was unnecessary.

Leave in macro substitution for '--action' though as this resolves Github issue #42.

Rework wording in Changes file
This commit is contained in:
Duncan Ferguson 2015-11-15 21:12:10 +00:00
parent 3f79f1ff54
commit 43d4f1d246
5 changed files with 9 additions and 36 deletions

View file

@ -529,11 +529,12 @@ sub substitute_macros {
{
my $macro_username = $self->config->{macro_username};
my $username = $servers{$svr}{username};
$username ||= getpwuid($UID);
$text =~ s!$macro_username!$username!xsmg;
}
{
my $macro_newline = $self->config->{macro_newline};
$text =~ s!$macro_newline!$/!xsmg;
$text =~ s!$macro_newline!\n!xsmg;
}
{
my $macro_version = $self->config->{macro_version};
@ -730,26 +731,10 @@ sub open_client_windows(@) {
# affecting the main program
$servers{$server}{realname} .= "==" if ( !$realname );
# If set, use the chdir path
if ( $self->config->{terminal_chdir} ) {
my $chdir_path = $self->substitute_macros( $server,
$self->config->{terminal_chdir_path} );
if ( !-d $chdir_path ) {
$self->debug( 1,
"Creating terminal directory path '$chdir_path'" );
make_path($chdir_path)
|| $self->debug( 0,
"WARNING: Could not create '$chdir_path'" );
}
$self->debug( 1,
"Changing directory to $chdir_path for terminal to $given_server_name"
);
chdir($chdir_path)
|| $self->debug( 0,
"WARNING: Could not change directory to '$chdir_path': $!"
);
}
# copy and amend the config provided to the helper script
my $local_config = $self->config;
$local_config->{command} = $self->substitute_macros( $server,
$local_config->{command} );
my $exec = join( ' ',
$self->config->{terminal},

View file

@ -63,9 +63,6 @@ my %default_config = (
terminal_decoration_height => 10,
terminal_decoration_width => 8,
terminal_chdir_path => $ENV{HOME} . '/.clusterssh/work/%s',
terminal_chdir => 0,
console => 'console',
console_args => '',
rsh => 'rsh',

View file

@ -63,7 +63,6 @@ sub script {
my \$port=shift;
my \$mstr=shift;
my \$command="$comms $comms_args ";
my \$cwd=qx!pwd!;
open(PIPE, ">", \$pipe) or die("Failed to open pipe: \$!\\n");
print PIPE "\$\$:\$ENV{WINDOWID}"
or die("Failed to write to pipe: $!\\n");
@ -101,9 +100,7 @@ sub script {
}
\$command .= " ; $postcommand";
# provide some info for debugging purposes
warn("Running: \\n");
warn(" pwd: \$cwd"); # already has newline
warn(" cmd: \$command\\n");
warn("Running: \$command\\n");
exec(\$command);
HERE