Lines Matching refs:err
88 filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
90 relPath, err := filepath.Rel(root, path)
91 if err != nil {
93 panic(err)
115 manifest, err := readManifest(manifestFile)
122 err = os.MkdirAll(sandboxesRoot, 0777)
123 if err != nil {
124 return fmt.Errorf("failed to create %q: %w", sandboxesRoot, err)
138 err = os.RemoveAll(tempDir)
139 if err != nil {
140 return err
142 err = os.MkdirAll(tempDir, 0777)
143 if err != nil {
144 return fmt.Errorf("failed to create temporary dir in %q: %w", sandboxesRoot, err)
167 depFile, err := runCommand(command, localTempDir)
168 if err != nil {
173 return err
188 err = rewriteDepFiles(commandDepFiles, outputDepFile)
189 if err != nil {
190 return fmt.Errorf("failed merging depfiles: %w", err)
199 manifestData, err := ioutil.ReadFile(file)
200 if err != nil {
201 return nil, fmt.Errorf("error reading manifest %q: %w", file, err)
206 err = proto.UnmarshalText(string(manifestData), &manifest)
207 if err != nil {
208 return nil, fmt.Errorf("error parsing manifest %q: %w", file, err)
216 func runCommand(command *sbox_proto.Command, tempDir string) (depFile string, err error) {
227 err = os.MkdirAll(tempDir, 0777)
228 if err != nil {
229 return "", fmt.Errorf("failed to create %q: %w", tempDir, err)
233 err = copyFiles(command.CopyBefore, "", tempDir, false)
234 if err != nil {
235 return "", err
237 err = copyRspFiles(command.RspFiles, tempDir, pathToTempDirInSbox)
238 if err != nil {
239 return "", err
253 err = makeOutputDirs(command.CopyAfter, tempDir)
254 if err != nil {
255 return "", err
267 absPath, err := makeAbsPathEnv(path)
268 if err != nil {
269 return "", err
271 err = os.Setenv("PATH", absPath)
272 if err != nil {
273 return "", fmt.Errorf("Failed to update PATH: %w", err)
276 err = cmd.Run()
278 if err != nil {
288 if exit, ok := err.(*exec.ExitError); ok && !exit.Success() {
300 if err != nil {
301 return "", err
336 err = moveFiles(command.CopyAfter, tempDir, "")
347 err := os.MkdirAll(dir, 0777)
348 if err != nil {
349 return err
361 fileInfo, err := os.Stat(fromPath)
362 if err != nil {
379 err := copyOneFile(fromPath, toPath, copyPair.GetExecutable(), allowFromNotExists)
380 if err != nil {
381 return fmt.Errorf("error copying %q to %q: %w", fromPath, toPath, err)
390 err := os.MkdirAll(filepath.Dir(to), 0777)
391 if err != nil {
392 return err
395 stat, err := os.Stat(from)
396 if err != nil {
397 if os.IsNotExist(err) && allowFromNotExists {
400 return err
408 in, err := os.Open(from)
409 if err != nil {
410 return err
417 err = os.Remove(to)
418 if err != nil && !os.IsNotExist(err) {
419 return err
422 out, err := os.Create(to)
423 if err != nil {
424 return err
428 if err != nil {
433 _, err = io.Copy(out, in)
434 if err != nil {
435 return err
438 if err = out.Close(); err != nil {
439 return err
442 if err = os.Chmod(to, perm); err != nil {
443 return err
453 err := copyOneRspFile(rspFile, toDir, toDirInSandbox)
454 if err != nil {
455 return err
464 in, err := os.Open(rspFile.GetFile())
465 if err != nil {
466 return err
470 files, err := response.ReadRspFile(in)
471 if err != nil {
472 return err
481 err := copyOneFile(from, joinPath(toDir, to), false, false)
482 if err != nil {
483 return err
494 err = os.MkdirAll(filepath.Dir(outRspFile), 0777)
495 if err != nil {
496 return err
499 out, err := os.Create(outRspFile)
500 if err != nil {
501 return err
506 err = response.WriteRspFile(out, files)
507 if err != nil {
508 return err
534 err := os.MkdirAll(filepath.Dir(toPath), 0777)
535 if err != nil {
536 return err
539 err = os.Rename(fromPath, toPath)
540 if err != nil {
541 return err
547 err = os.Chtimes(toPath, now, now)
548 if err != nil {
549 return err
560 data, err := ioutil.ReadFile(in)
561 if err != nil {
562 return err
565 deps, err := makedeps.Parse(in, bytes.NewBuffer(data))
566 if err != nil {
567 return err
581 err := os.MkdirAll(outDir, 0777)
582 if err != nil {
583 return fmt.Errorf("failed to create %q: %w", outDir, err)
602 absPath, err := filepath.Abs(p)
603 if err != nil {
604 return "", fmt.Errorf("failed to make PATH entry %q absolute: %w", p, err)