Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 974 for getwd (0.24 sec)

  1. src/os/path_windows.go

    	if !filepathlite.IsAbs(path) {
    		// If the path is relative, we need to prepend the working directory
    		// plus a separator to the path before we can determine if it's too long.
    		// We don't want to call syscall.Getwd here, as that call is expensive to do
    		// 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
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 18:44:48 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  2. src/cmd/go/internal/base/path.go

    // UncachedCwd is appropriate to call early in program startup before flag parsing,
    // because the -C flag may change the current directory.
    func UncachedCwd() string {
    	wd, err := os.Getwd()
    	if err != nil {
    		Fatalf("cannot determine current directory: %v", err)
    	}
    	return wd
    }
    
    // Cwd returns the current working directory at the time of the first call.
    func Cwd() string {
    	cwdOnce.Do(func() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat May 20 19:17:27 UTC 2023
    - 2K bytes
    - Viewed (0)
  3. cmd/gotemplate/gotemplate_test.go

    		},
    		"include": {
    			in:       `{{include "test.txt" | indent 2}}`,
    			files:    map[string]string{"test.txt": "hello\nworld"},
    			expected: "hello\n  world",
    		},
    	} {
    		cwd, err := os.Getwd()
    		require.NoError(t, err)
    
    		t.Run(name, func(t *testing.T) {
    			tmp := t.TempDir()
    			for fileName, fileContent := range tt.files {
    				err := os.WriteFile(path.Join(tmp, fileName), []byte(fileContent), 0666)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jan 22 13:43:42 UTC 2024
    - 2.7K bytes
    - Viewed (0)
  4. src/os/os_test.go

    			select {
    			case <-done:
    				return
    			case <-hold:
    			}
    			// Getwd might be wrong
    			f0, err := Stat(".")
    			if err != nil {
    				t.Error(err)
    				return
    			}
    			pwd, err := Getwd()
    			if err != nil {
    				t.Errorf("Getwd: %v", err)
    				return
    			}
    			if pwd != d {
    				t.Errorf("Getwd() = %q, want %q", pwd, d)
    				return
    			}
    			f1, err := Stat(pwd)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 83.1K bytes
    - Viewed (0)
  5. src/runtime/testdata/testprog/syscalls_linux.go

    }
    
    func getcwd() (string, error) {
    	if !syscall.ImplementsGetwd {
    		return "", nil
    	}
    	// Use the syscall to get the current working directory.
    	// This is imperative for checking for OS thread state
    	// after an unshare since os.Getwd might just check the
    	// environment, or use some other mechanism.
    	var buf [4096]byte
    	n, err := syscall.Getcwd(buf[:])
    	if err != nil {
    		return "", err
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 20:00:09 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  6. src/cmd/link/internal/ld/dwarf_test.go

    	}
    
    	if wd, err := os.Getwd(); err == nil {
    		gopathdir := filepath.Join(wd, "testdata", "issue25459")
    		abstractOriginSanity(t, gopathdir, DefaultOpt)
    	} else {
    		t.Fatalf("os.Getwd() failed %v", err)
    	}
    }
    
    func TestAbstractOriginSanityIssue26237(t *testing.T) {
    	testenv.MustHaveGoBuild(t)
    
    	mustHaveDWARF(t)
    	if wd, err := os.Getwd(); err == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 08 01:38:11 UTC 2024
    - 48.6K bytes
    - Viewed (0)
  7. src/cmd/go/internal/script/state.go

    			return err
    		}
    		if err := os.WriteFile(name, f.Data, 0666); err != nil {
    			return err
    		}
    	}
    
    	return nil
    }
    
    // Getwd returns the directory in which to run the next script command.
    func (s *State) Getwd() string { return s.pwd }
    
    // Logf writes output to the script's log without updating its stdout or stderr
    // buffers. (The output log functions as a kind of meta-stderr.)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 31 20:33:02 UTC 2023
    - 6.9K bytes
    - Viewed (0)
  8. src/os/executable_test.go

    	}
    	return os.SameFile(fi1, fi2)
    }
    
    func init() {
    	if e := os.Getenv(executable_EnvVar); e != "" {
    		// first chdir to another path
    		dir := "/"
    		if runtime.GOOS == "windows" {
    			cwd, err := os.Getwd()
    			if err != nil {
    				panic(err)
    			}
    			dir = filepath.VolumeName(cwd)
    		}
    		os.Chdir(dir)
    		if ep, err := os.Executable(); err != nil {
    			fmt.Fprint(os.Stderr, "ERROR: ", err)
    		} else {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 05 23:35:32 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  9. src/path/filepath/path_test.go

    // 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() {
    		if err := os.Chdir(olddir); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 22 16:38:19 UTC 2024
    - 47.1K bytes
    - Viewed (0)
  10. src/cmd/go/scriptcmds_test.go

    	return script.Command(
    		script.CmdUsage{
    			Summary: "run the platform C compiler",
    			Args:    "args...",
    		},
    		func(s *script.State, args ...string) (script.WaitFunc, error) {
    			b := work.NewBuilder(s.Getwd())
    			wait, err := cmdExec.Run(s, append(b.GccCmd(".", ""), args...)...)
    			if err != nil {
    				return wait, err
    			}
    			waitAndClean := func(s *script.State) (stdout, stderr string, err error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 07 18:33:17 UTC 2024
    - 3.3K bytes
    - Viewed (0)
Back to top