Avoid unnecessary use of cat

This commit is contained in:
Kovid Goyal 2022-05-27 14:18:16 +05:30
parent 83602d7e53
commit e82c5a63b5
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 2 deletions

View File

@ -376,7 +376,7 @@ edit-in-kitty() {
data="$data,file_inode=$stat_result"
builtin local file_size=$(builtin echo "$stat_result" | builtin command cut -d: -f3)
[ "$file_size" -gt $((8 * 1024 * 1024)) ] && { builtin echo "File is too large for performant editing"; return 1; }
data="$data,file_data=$(builtin command cat "$ed_filename" | builtin command base64)"
data="$data,file_data=$(builtin command base64 < "$ed_filename")"
_ksi_transmit_data "$data" "edit"
data=""
builtin echo "Waiting for editing to be completed..."

View File

@ -460,7 +460,7 @@ edit-in-kitty() {
builtin zstat -H stat_result "$ed_filename" || { builtin echo "Failed to stat the file: $ed_filename" > /dev/stderr; return 1; }
[ "${stat_result[size]}" -gt $((8 * 1024 * 1024)) ] && { builtin echo "File is too large for performant editing"; return 1; }
data="$data,file_inode=${stat_result[device]}:${stat_result[inode]}:${stat_result[size]}"
data="$data,file_data=$(builtin command cat "$ed_filename" | builtin command base64)"
data="$data,file_data=$(builtin command base64 < "$ed_filename")"
_ksi_transmit_data "$data" "edit"
data=""
builtin echo "Waiting for editing to be completed..."