Use FileUtils.cp for local send_file when no user switch needed#403
Use FileUtils.cp for local send_file when no user switch needed#403neidiom wants to merge 1 commit intoitamae-kitchen:masterfrom
Conversation
unasuke
left a comment
There was a problem hiding this comment.
The description says the shell pipeline was "unnecessarily complex," but after this change, the pipeline still remains for the user case, and adding a branch on top of it.
When no user switch is required, use FileUtils.cp instead of piping through cat, avoiding an unnecessary shell pipeline for the common case.
89c8770 to
5931dde
Compare
Please check now. |
@neidiom What changes have been made since my last review comment? |
I updated the description. |
|
@neidiom Understood, thank you. However, I still prefer the current more generic code over adding an if-branch to use |
ok. Shall we close the PR :) |
The existing shell pipeline (cat src | sudo cat > dst) is necessary when switching users, since sudo handles writing as a different user. But for the common case with no user switch, piping through cat is redundant — FileUtils.cp is simpler, avoids spawning shell processes, and makes the intent clearer.