2010/5/11 Iustin Pop <ius...@google.com>: > On Mon, May 10, 2010 at 05:30:41PM +0200, Michael Hanselmann wrote: >> +def BackupFile(node, path): >> + """Creates a backup of a file on the node and returns the filename. >> + >> + Caller needs to remove the returned file on the node when it's not needed >> + anymore. >> + >> + """ >> + cmd = ("tmp=$(tempfile --prefix .gnt --directory=$(dirname %s)) && " >> + "[[ -f \"$tmp\" ]] && " >> + "cat %s > $tmp && " >> + "echo $tmp") % (utils.ShellQuote(path), utils.ShellQuote(path)) > > Mmm, cat? cp? Anyway LGTM.
That's what I get for copying code. Will push with this change: --- a/qa/qa_utils.py +++ b/qa/qa_utils.py @@ -181,7 +181,7 @@ def BackupFile(node, path): """ cmd = ("tmp=$(tempfile --prefix .gnt --directory=$(dirname %s)) && " "[[ -f \"$tmp\" ]] && " - "cat %s > $tmp && " + "cp %s $tmp && " "echo $tmp") % (utils.ShellQuote(path), utils.ShellQuote(path)) # Return temporary filename Michael