Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 303 for getwd (0.05 sec)

  1. src/syscall/pwd_plan9.go

    		}
    	}
    	return false
    }
    
    // goroutine-specific getwd
    func getwd() (wd string, err error) {
    	fd, err := open(".", O_RDONLY)
    	if err != nil {
    		return "", err
    	}
    	defer Close(fd)
    	return Fd2path(fd)
    }
    
    func Getwd() (wd string, err error) {
    	wdmu.Lock()
    	defer wdmu.Unlock()
    
    	if wdSet {
    		return wdStr, nil
    	}
    	wd, err = getwd()
    	if err != nil {
    		return
    	}
    	wdSet = true
    	wdStr = wd
    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/os/executable_solaris.go

    package os
    
    import (
    	"syscall"
    	_ "unsafe" // for linkname
    )
    
    //go:linkname executablePath
    var executablePath string // set by sysauxv in ../runtime/os3_solaris.go
    
    var initCwd, initCwdErr = Getwd()
    
    func executable() (string, error) {
    	path := executablePath
    	if len(path) == 0 {
    		path, err := syscall.Getexecname()
    		if err != nil {
    			return path, err
    		}
    	}
    	if len(path) > 0 && path[0] != '/' {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 19:57:43 UTC 2024
    - 757 bytes
    - Viewed (0)
  3. src/os/executable_darwin.go

    package os
    
    import (
    	"errors"
    	_ "unsafe" // for linkname
    )
    
    //go:linkname executablePath
    var executablePath string // set by ../runtime/os_darwin.go
    
    var initCwd, initCwdErr = Getwd()
    
    func executable() (string, error) {
    	ep := executablePath
    	if len(ep) == 0 {
    		return ep, errors.New("cannot find executable path")
    	}
    	if ep[0] != '/' {
    		if initCwdErr != nil {
    			return ep, initCwdErr
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 19:57:43 UTC 2024
    - 675 bytes
    - Viewed (0)
  4. src/cmd/compile/internal/test/pgo_devirtualize_test.go

    	}
    }
    
    // TestPGODevirtualize tests that specific functions are devirtualized when PGO
    // is applied to the exact source that was profiled.
    func TestPGODevirtualize(t *testing.T) {
    	wd, err := os.Getwd()
    	if err != nil {
    		t.Fatalf("error getting wd: %v", err)
    	}
    	srcDir := filepath.Join(wd, "testdata", "pgo", "devirtualize")
    
    	// Copy the module to a scratch location so we can add a go.mod.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 15 21:30:35 UTC 2024
    - 8.5K bytes
    - Viewed (0)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. src/net/http/cgi/cgi_main.go

    	keys = make([]string, 0, len(envs))
    	for k := range envs {
    		keys = append(keys, k)
    	}
    	slices.Sort(keys)
    	for _, key := range keys {
    		fmt.Printf("env-%s=%s\r\n", key, envs[key])
    	}
    
    	cwd, _ := os.Getwd()
    	fmt.Printf("cwd=%s\r\n", cwd)
    }
    
    type neverEnding byte
    
    func (b neverEnding) Read(p []byte) (n int, err error) {
    	for i := range p {
    		p[i] = byte(b)
    	}
    	return len(p), nil
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 3.1K bytes
    - Viewed (0)
  10. src/syscall/syscall_js.go

    }
    
    func Sysctl(key string) (string, error) {
    	if key == "kern.hostname" {
    		return "js", nil
    	}
    	return "", ENOSYS
    }
    
    const ImplementsGetwd = true
    
    func Getwd() (wd string, err error) {
    	var buf [PathMax]byte
    	n, err := Getcwd(buf[0:])
    	if err != nil {
    		return "", err
    	}
    	return string(buf[:n]), nil
    }
    
    func Getuid() int {
    	return jsProcess.Call("getuid").Int()
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 21:03:59 UTC 2024
    - 6.7K bytes
    - Viewed (0)
Back to top