MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / GetRemoteUserInfo

Method GetRemoteUserInfo

cli/pkg/common/sshremote.go:147–164  ·  view source on GitHub ↗

获取远程uid,gid

()

Source from the content-addressed store, hash-verified

145
146// 获取远程uid,gid
147func (sshRemote *SSHRemote) GetRemoteUserInfo() (Uid string, Gid string) {
148 remuid, err := sshRemote.ExeSSHCommand("id -u $USER")
149 remgid, remgiderr := sshRemote.ExeSSHCommand("id -g $USER")
150 SmartIDELog.Debug("Remote---Uid:" + remuid)
151 SmartIDELog.Debug("Remote---Gid:" + remgid)
152
153 if remuid != "" && err == nil {
154 Uid = remuid
155 } else {
156 Uid = "1000"
157 }
158 if remgid != "" && remgiderr == nil {
159 Gid = remgid
160 } else {
161 Gid = "1000"
162 }
163 return Uid, Gid
164}
165
166// 当前目录是否已经clone
167func (instance *SSHRemote) IsCloned(workSpaceDir string) bool {

Callers 1

Calls 2

ExeSSHCommandMethod · 0.95
DebugMethod · 0.80

Tested by

no test coverage detected