get realpath in collect

pull/3/head
Simon Let 7 years ago
parent bf9167e96a
commit 833acae4da
  1. 1
      bashrc.sh
  2. 25
      collect/resh-collect.go
  3. 2
      common/resh-common.go

@ -59,7 +59,6 @@ precmd() {
-login "$__RESH_LOGIN" \
-path "$__RESH_PATH" \
-pwd "$__RESH_PWD" \
-realPwd "$(realpath $__RESH_PWD)" \
-shell "$__RESH_SHELL" \
-term "$__RESH_TERM" \
-pid "$__RESH_PID" -shellPid "$__RESH_SHELL_PID" \

@ -53,7 +53,6 @@ func main() {
windowId := flag.Int("windowId", -1, "$WINDOWID - session id")
shlvl := flag.Int("shlvl", -1, "$SHLVL")
realPwd := flag.String("realPwd", "", "realpath $PWD")
host := flag.String("host", "", "$HOSTNAME")
hosttype := flag.String("hosttype", "", "$HOSTTYPE")
ostype := flag.String("ostype", "", "$OSTYPE")
@ -95,6 +94,12 @@ func main() {
realtimeBeforeLocal := realtimeBefore + timezoneBeforeOffset
realtimeAfterLocal := realtimeAfter + timezoneAfterOffset
realPwd, err := filepath.EvalSymlinks(*pwd)
if err != nil {
log.Println("err while handling realpath:", err)
realPwd = ""
}
gitDir, gitRealDir := getGitDirs(*gitCdup, *gitCdupExitCode, *pwd)
if *gitRemoteExitCode != 0 {
*gitRemote = ""
@ -119,15 +124,15 @@ func main() {
Term: *term,
// non-posix
RealpathPwd: *realPwd,
Pid: *pid,
ShellPid: *shellPid,
WindowId: *windowId,
Host: *host,
Hosttype: *hosttype,
Ostype: *ostype,
Machtype: *machtype,
Shlvl: *shlvl,
RealPwd: realPwd,
Pid: *pid,
ShellPid: *shellPid,
WindowId: *windowId,
Host: *host,
Hosttype: *hosttype,
Ostype: *ostype,
Machtype: *machtype,
Shlvl: *shlvl,
// before after
TimezoneBefore: *timezoneBefore,

@ -18,7 +18,7 @@ type Record struct {
Term string `json:"term"`
// non-posix"`
RealpathPwd string `json:"realpathPwd"`
RealPwd string `json:"realPwd"`
Pid int `json:"pid"`
ShellPid int `json:"shellPid"`
WindowId int `json:"windowId"`

Loading…
Cancel
Save