File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -148,25 +148,20 @@ func (v *Virtualenv) UpdateBinShebangs(binGlob string) error {
148148 return err
149149 }
150150 defer tmp .Close ()
151+ defer os .Remove (tmp .Name ())
151152
152153 if err = v .replaceShebang (f , tmp ); err != nil {
153154 return err
154155 }
155156
156- if err := tmp .Close (); err != nil {
157- return err
158- }
159-
160- if err := f .Close (); err != nil {
157+ // overwrite the original bin file with the fixed version
158+ if _ , err = io .Copy (tmp , f ); err != nil {
161159 return err
162160 }
163161
164- // overwrite the original bin file with the fixed version
165- if err := os .Rename (tmp .Name (), path ); err != nil {
162+ if err = os .Chmod (path , permissions ); err != nil {
166163 return err
167164 }
168-
169- os .Chmod (path , permissions )
170165 }
171166
172167 return nil
You can’t perform that action at this time.
0 commit comments