Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 40 for chdir (0.05 sec)

  1. src/os/os_windows_test.go

    type syscallDescriptor = syscall.Handle
    
    // chdir changes the current working directory to the named directory,
    // and then restore the original working directory at the end of the test.
    func chdir(t *testing.T, dir string) {
    	olddir, err := os.Getwd()
    	if err != nil {
    		t.Fatalf("chdir: %v", err)
    	}
    	if err := os.Chdir(dir); err != nil {
    		t.Fatalf("chdir %s: %v", dir, err)
    	}
    
    	t.Cleanup(func() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 41.8K bytes
    - Viewed (0)
  2. src/os/path_windows.go

    		// every time fixLongPath is called with a relative path, so we use a cache.
    		// Note that getwdCache might be outdated if the working directory has been
    		// changed without using os.Chdir, i.e. using syscall.Chdir directly or cgo.
    		// This is fine, as the worst that can happen is that we fail to fix the path.
    		getwdCache.Lock()
    		if getwdCache.dir == "" {
    			// Init the working directory cache.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 18:44:48 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  3. src/os/exec_posix.go

    	// If there is no SysProcAttr (ie. no Chroot or changed
    	// UID/GID), double-check existence of the directory we want
    	// to chdir into. We can make the error clearer this way.
    	if attr != nil && attr.Sys == nil && attr.Dir != "" {
    		if _, err := Stat(attr.Dir); err != nil {
    			pe := err.(*PathError)
    			pe.Op = "chdir"
    			return nil, pe
    		}
    	}
    
    	sysattr := &syscall.ProcAttr{
    		Dir: attr.Dir,
    		Env: attr.Env,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 22:06:47 UTC 2024
    - 3.7K bytes
    - Viewed (0)
  4. src/testing/internal/testdeps/deps.go

    	l.add("getenv", key)
    }
    
    func (l *testLog) Open(name string) {
    	l.add("open", name)
    }
    
    func (l *testLog) Stat(name string) {
    	l.add("stat", name)
    }
    
    func (l *testLog) Chdir(name string) {
    	l.add("chdir", name)
    }
    
    // add adds the (op, name) pair to the test log.
    func (l *testLog) add(op, name string) {
    	if strings.Contains(name, "\n") || name == "" {
    		return
    	}
    
    	l.mu.Lock()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 14:01:23 UTC 2024
    - 6.2K bytes
    - Viewed (0)
  5. src/cmd/doc/main.go

    	flagSet.BoolVar(&short, "short", false, "one-line representation for each symbol")
    	flagSet.Parse(args)
    	telemetry.Inc("doc/invocations")
    	telemetry.CountFlags("doc/flag:", *flag.CommandLine)
    	if chdir != "" {
    		if err := os.Chdir(chdir); err != nil {
    			return err
    		}
    	}
    	var paths []string
    	var symbol, method string
    	// Loop until something is printed.
    	dirs.Reset()
    	for i := 0; ; i++ {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 19:41:17 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  6. src/os/file_plan9.go

    		dir = "/tmp"
    	}
    	return dir
    }
    
    // Chdir changes the current working directory to the file,
    // which must be a directory.
    // If there is an error, it will be of type *PathError.
    func (f *File) Chdir() error {
    	if err := f.incref("chdir"); err != nil {
    		return err
    	}
    	defer f.decref()
    	if e := syscall.Fchdir(f.fd); e != nil {
    		return &PathError{Op: "chdir", Path: f.name, Err: e}
    	}
    	return nil
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 30 15:35:30 UTC 2024
    - 16K bytes
    - Viewed (0)
  7. src/os/os_test.go

    	if err != nil {
    		t.Fatalf("Getwd: %s", err)
    	}
    	defer Chdir(wd)
    
    	fd, err := Open(".")
    	if err != nil {
    		t.Fatalf("Open .: %s", err)
    	}
    	defer fd.Close()
    
    	if err := Chdir("/"); err != nil {
    		t.Fatalf("Chdir /: %s", err)
    	}
    
    	if err := fd.Chdir(); err != nil {
    		t.Fatalf("fd.Chdir: %s", err)
    	}
    
    	wdNew, err := Getwd()
    	if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 83.1K bytes
    - Viewed (0)
  8. src/os/path_windows_test.go

    	testMkdirAllAtRoot(t, volName)
    }
    
    func TestRemoveAllLongPathRelative(t *testing.T) {
    	// Test that RemoveAll doesn't hang with long relative paths.
    	// See go.dev/issue/36375.
    	tmp := t.TempDir()
    	chdir(t, tmp)
    	dir := filepath.Join(tmp, "foo", "bar", strings.Repeat("a", 150), strings.Repeat("b", 150))
    	err := os.MkdirAll(dir, 0755)
    	if err != nil {
    		t.Fatal(err)
    	}
    	err = os.RemoveAll("foo")
    	if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 23 16:37:32 UTC 2024
    - 8K bytes
    - Viewed (0)
  9. src/os/file.go

    		return err
    	}
    	return Chmod(name, fi.Mode()|ModeSticky)
    }
    
    // Chdir changes the current working directory to the named directory.
    // If there is an error, it will be of type *PathError.
    func Chdir(dir string) error {
    	if e := syscall.Chdir(dir); e != nil {
    		testlog.Open(dir) // observe likely non-existent directory
    		return &PathError{Op: "chdir", Path: dir, Err: e}
    	}
    	if runtime.GOOS == "windows" {
    		getwdCache.Lock()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 23:07:37 UTC 2024
    - 25.4K bytes
    - Viewed (0)
  10. src/cmd/go/main.go

    //
    //  2. A toolchain switch later on reinvokes the new go command with the same arguments.
    //     The parent toolchain has already done the chdir; the child must not try to do it again.
    func handleChdirFlag() {
    	_, used := lookupCmd(os.Args[1:])
    	used++ // because of [1:]
    	if used >= len(os.Args) {
    		return
    	}
    
    	var dir string
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 21:09:11 UTC 2024
    - 10K bytes
    - Viewed (0)
Back to top