From 4c3512a5587c6e3746a35f592ec8f4cacc7630fa Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Sun, 11 Nov 2018 15:48:38 +1100 Subject: [PATCH] * lib/ssh.exp: Clean up whitespace. * lib/remote.exp: Clean up whitespace. (remote_expect): Change literal tab to "\t" in regexp. Signed-off-by: Ben Elliston --- ChangeLog | 6 ++++++ lib/remote.exp | 38 +++++++++++++++++++------------------- lib/ssh.exp | 2 +- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa5a219..40b0a9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-11-11 Jacob Bachmeyer + + * lib/ssh.exp: Clean up whitespace. + * lib/remote.exp: Clean up whitespace. + (remote_expect): Change literal tab to "\t" in regexp. + 2018-11-05 Ben Elliston * config.guess: Update to latest version. diff --git a/lib/remote.exp b/lib/remote.exp index 3d5d176..56b75f2 100644 --- a/lib/remote.exp +++ b/lib/remote.exp @@ -76,9 +76,9 @@ proc close_wait_program { program_id pid {wres_varname ""} } { # Do so separately for each PID in the list to avoid differences # in return value behavior for kill between shells foreach spid $pid { - # Prepend "-" to generate the "process group ID" needed by - # kill. - exec sh -c "exec > /dev/null 2>&1 && (kill -2 -$spid || kill -2 $spid)" + # Prepend "-" to generate the "process group ID" needed by + # kill. + exec sh -c "exec > /dev/null 2>&1 && (kill -2 -$spid || kill -2 $spid)" } # If the program doesn't exit gracefully when stdin closes, @@ -91,11 +91,11 @@ proc close_wait_program { program_id pid {wres_varname ""} } { set sh_cmd "exec > /dev/null 2>&1" append sh_cmd " && sleep $secs && (" foreach spid $pid { - append sh_cmd "(kill -15 -$spid || kill -15 $spid);" + append sh_cmd "(kill -15 -$spid || kill -15 $spid);" } append sh_cmd ") && sleep $secs && (" foreach spid $pid { - append sh_cmd "(kill -9 -$spid || kill -9 $spid);" + append sh_cmd "(kill -9 -$spid || kill -9 $spid);" } append sh_cmd ") && sleep $secs" set exec_pid [exec sh -c "$sh_cmd" &] @@ -321,14 +321,14 @@ proc remote_exec { hostname program args } { if { ![is_remote $hostname] } { set result [local_exec "$program $pargs" $inp $outp $timeout] } else { - if { [board_info $hostname exists remotedir] } { - set remotedir [board_info $hostname remotedir] + if { [board_info $hostname exists remotedir] } { + set remotedir [board_info $hostname remotedir] # This is a bit too clever. Join cd $remotedir and # $program on the command line with ';' and not '&&'. When # called, $program may be mkdir to initially create the # remote directory, in which case cd would fail. - set program "test -d $remotedir && cd $remotedir; $program" - } + set program "test -d $remotedir && cd $remotedir; $program" + } set result [call_remote "" exec $hostname $program $pargs $inp $outp] } @@ -468,13 +468,13 @@ proc remote_download { dest file args } { } } if { [board_info $dest exists remotedir] } { - set remotedir [board_info $dest remotedir] - set status [remote_exec $dest mkdir "-p $remotedir"] - if { [lindex $status 0] != 0 } { - perror "Couldn't create remote directory $remotedir on $dest" + set remotedir [board_info $dest remotedir] + set status [remote_exec $dest mkdir "-p $remotedir"] + if { [lindex $status 0] != 0 } { + perror "Couldn't create remote directory $remotedir on $dest" return "" - } - set destfile "$remotedir/$destfile" + } + set destfile "$remotedir/$destfile" } return [call_remote "" download $dest $file $destfile] @@ -1078,9 +1078,9 @@ proc standard_load { dest prog args } { } if {[is_remote $dest]} { - if {![board_info $dest exists remotedir]} { - set board_info($dest,remotedir) "/tmp/runtest.[pid]" - } + if {![board_info $dest exists remotedir]} { + set board_info($dest,remotedir) "/tmp/runtest.[pid]" + } set remotefile [file tail $prog] set remotefile [remote_download $dest $prog $remotefile] if { $remotefile == "" } { @@ -1271,7 +1271,7 @@ proc remote_expect { board timeout args } { } set x "[lrange $args $i $i]" - regsub "^\n*\[ \]*" "$x" "" x + regsub "^\n*\[ \t\]*" "$x" "" x if { $x == "-i" || $x == "-timeout" || $x == "-ex" } { append res "$x " diff --git a/lib/ssh.exp b/lib/ssh.exp index 5487589..c589ca9 100644 --- a/lib/ssh.exp +++ b/lib/ssh.exp @@ -204,7 +204,7 @@ proc ssh_close { desthost } { global SSH ssh_initialized verbose "Closing the SSH connection to $desthost" - + set ssh_port "" set scp_port "" set ssh_user "" -- 2.7.4