File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
crates/uv/src/commands/project Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1781,7 +1781,19 @@ fn copy_entrypoint(
1781
1781
1782
1782
let mut contents = String :: new ( ) ;
1783
1783
file. seek ( std:: io:: SeekFrom :: Start ( 0 ) ) ?;
1784
- file. read_to_string ( & mut contents) ?;
1784
+ match file. read_to_string ( & mut contents) {
1785
+ Ok ( _) => { }
1786
+ Err ( err) if err. kind ( ) == std:: io:: ErrorKind :: InvalidData => {
1787
+ // If the file is not valid UTF-8, we skip it in case it was a binary file with `#!` at
1788
+ // the start (which seems pretty niche, but being defensive here seems safe)
1789
+ trace ! (
1790
+ "Skipping copy of entrypoint `{}`: is not valid UTF-8" ,
1791
+ source. user_display( )
1792
+ ) ;
1793
+ return Ok ( ( ) ) ;
1794
+ }
1795
+ Err ( err) => return Err ( err. into ( ) ) ,
1796
+ }
1785
1797
1786
1798
let Some ( contents) = contents
1787
1799
// Check for a relative path or relocatable shebang
You can’t perform that action at this time.
0 commit comments