| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package isolate | 5 package isolate |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "encoding/json" | 9 "encoding/json" |
| 10 "errors" | 10 "errors" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } else { | 272 } else { |
| 273 // Grab the stats right away. | 273 // Grab the stats right away. |
| 274 info, err := os.Lstat(dep) | 274 info, err := os.Lstat(dep) |
| 275 if err != nil { | 275 if err != nil { |
| 276 return nil, err | 276 return nil, err |
| 277 } | 277 } |
| 278 mode := info.Mode() | 278 mode := info.Mode() |
| 279 if mode&os.ModeSymlink == os.ModeSymlink { | 279 if mode&os.ModeSymlink == os.ModeSymlink { |
| 280 l, err := os.Readlink(dep) | 280 l, err := os.Readlink(dep) |
| 281 if err != nil { | 281 if err != nil { |
| 282 » » » » » return nil, err | 282 » » » » » // Kill the process: there's no reason t
o continue if a file is |
| 283 » » » » » // unavailable. |
| 284 » » » » » log.Fatalf("Unable to stat %q: %v", dep,
err) |
| 283 } | 285 } |
| 284 i.Files[relPath] = isolated.SymLink(l) | 286 i.Files[relPath] = isolated.SymLink(l) |
| 285 } else { | 287 } else { |
| 286 i.Files[relPath] = isolated.BasicFile("", int(mo
de.Perm()), info.Size()) | 288 i.Files[relPath] = isolated.BasicFile("", int(mo
de.Perm()), info.Size()) |
| 287 fileItems = append(fileItems, arch.PushFile(relP
ath, dep, -info.Size())) | 289 fileItems = append(fileItems, arch.PushFile(relP
ath, dep, -info.Size())) |
| 288 } | 290 } |
| 289 } | 291 } |
| 290 } | 292 } |
| 291 | 293 |
| 292 for _, item := range fileItems { | 294 for _, item := range fileItems { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 317 raw := &bytes.Buffer{} | 319 raw := &bytes.Buffer{} |
| 318 if err = json.NewEncoder(raw).Encode(i); err != nil { | 320 if err = json.NewEncoder(raw).Encode(i); err != nil { |
| 319 return nil, err | 321 return nil, err |
| 320 } | 322 } |
| 321 | 323 |
| 322 if err := ioutil.WriteFile(opts.Isolated, raw.Bytes(), 0644); err != nil
{ | 324 if err := ioutil.WriteFile(opts.Isolated, raw.Bytes(), 0644); err != nil
{ |
| 323 return nil, err | 325 return nil, err |
| 324 } | 326 } |
| 325 return arch.Push(displayName, isolatedclient.NewBytesSource(raw.Bytes())
, 0), nil | 327 return arch.Push(displayName, isolatedclient.NewBytesSource(raw.Bytes())
, 0), nil |
| 326 } | 328 } |
| OLD | NEW |