Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 80 for chdir (0.14 sec)

  1. src/syscall/pwd_plan9.go

    		return
    	}
    	wdSet = true
    	wdStr = wd
    	return wd, nil
    }
    
    func Chdir(path string) error {
    	// If Chdir is to a relative path, sync working dir first
    	if fixwd(path) {
    		defer runtime.UnlockOSThread()
    	}
    	wdmu.Lock()
    	defer wdmu.Unlock()
    
    	runtime.LockOSThread()
    	defer runtime.UnlockOSThread()
    	if err := chdir(path); err != nil {
    		return err
    	}
    
    	wd, err := getwd()
    	if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 21:03:59 UTC 2024
    - 2.3K bytes
    - Viewed (0)
  2. src/cmd/go/testdata/script/test_cache_inputs.txt

    stdout '\(cached\)'
    
    # Files should be tracked even if the test changes its working directory.
    go test testcache -run=Chdir
    go test testcache -run=Chdir
    stdout '\(cached\)'
    cp 6x.txt testcache/file.txt
    go test testcache -run=Chdir
    ! stdout '\(cached\)'
    go test testcache -run=Chdir
    stdout '\(cached\)'
    
    # The content of files should affect caching, provided that the mtime also changes.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Mar 09 22:23:53 UTC 2024
    - 6.3K bytes
    - Viewed (0)
  3. src/runtime/testdata/testprog/lockosthread.go

    				println("unshare not permitted")
    				os.Exit(0)
    			}
    			println("failed to unshare fs:", err.Error())
    			os.Exit(1)
    		}
    		// Chdir to somewhere else on this thread.
    		// On systems other than Linux, this is a no-op.
    		if err := chdir(os.TempDir()); err != nil {
    			println("failed to chdir:", err.Error())
    			os.Exit(1)
    		}
    
    		// The state on this thread is now considered "tainted", but it
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 20:00:09 UTC 2024
    - 6.6K bytes
    - Viewed (0)
  4. src/os/removeall_test.go

    	}
    	defer RemoveAll(tempDir)
    
    	err = Chdir(tempDir)
    	if err != nil {
    		t.Fatalf("Could not chdir to tempdir: %s", err)
    	}
    
    	err = RemoveAll(".")
    	if err == nil {
    		t.Errorf("RemoveAll succeed to remove .")
    	}
    
    	err = Chdir(prevDir)
    	if err != nil {
    		t.Fatalf("Could not chdir %s: %s", prevDir, err)
    	}
    }
    
    func TestRemoveAllDotDot(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:21:29 UTC 2024
    - 12.3K bytes
    - Viewed (0)
  5. cmd/gotemplate/gotemplate_test.go

    			for fileName, fileContent := range tt.files {
    				err := os.WriteFile(path.Join(tmp, fileName), []byte(fileContent), 0666)
    				require.NoError(t, err, "create input file")
    			}
    			defer os.Chdir(cwd)
    			require.NoError(t, os.Chdir(tmp), "change into tmp directory")
    			in := strings.NewReader(tt.in)
    			var out bytes.Buffer
    			err := generate(in, &out, tt.data)
    			if tt.expectedErr == "" {
    				require.NoError(t, err, "expand template")
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jan 22 13:43:42 UTC 2024
    - 2.7K bytes
    - Viewed (0)
  6. src/path/filepath/path_test.go

    		}
    		return err
    	}
    	return nil
    }
    
    // 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("getwd %s: %v", dir, 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: Fri Mar 22 16:38:19 UTC 2024
    - 47.1K bytes
    - Viewed (0)
  7. src/runtime/testdata/testprog/syscalls_linux.go

    }
    
    func unshareFs() error {
    	err := syscall.Unshare(syscall.CLONE_FS)
    	if testenv.SyscallIsNotSupported(err) {
    		return errNotPermitted
    	}
    	return err
    }
    
    func chdir(path string) error {
    	return syscall.Chdir(path)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 20:00:09 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  8. src/os/file_posix.go

    	}
    	return nil
    }
    
    // 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.checkValid("chdir"); err != nil {
    		return err
    	}
    	if e := f.pfd.Fchdir(); e != nil {
    		return f.wrapErr("chdir", e)
    	}
    	return nil
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 21:33:12 UTC 2024
    - 7.1K bytes
    - Viewed (0)
  9. 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)
  10. src/runtime/testdata/testprog/syscalls_none.go

    }
    
    func tidExists(tid int) (exists, supported bool, err error) {
    	return false, false, nil
    }
    
    func getcwd() (string, error) {
    	return "", nil
    }
    
    func unshareFs() error {
    	return nil
    }
    
    func chdir(path string) error {
    	return nil
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 20:00:09 UTC 2024
    - 471 bytes
    - Viewed (0)
Back to top