Fix SpacetimeDB root-dir owner detection false positives
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
@@ -577,7 +577,24 @@ is_spacetime_ready() {
|
||||
|
||||
describe_spacetime_root_owner() {
|
||||
if command -v ps >/dev/null 2>&1; then
|
||||
ps -ef 2>/dev/null | grep '[s]pacetime' | grep -F "${SPACETIME_ROOT_DIR}" || true
|
||||
ps -eo user=,pid=,ppid=,stat=,comm=,args= 2>/dev/null | awk -v root_dir="${SPACETIME_ROOT_DIR}" '
|
||||
{
|
||||
user = $1
|
||||
pid = $2
|
||||
ppid = $3
|
||||
stat = $4
|
||||
command = $5
|
||||
args = $0
|
||||
sub(/^[[:space:]]*[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]*/, "", args)
|
||||
name = command
|
||||
sub(/^.*\//, "", name)
|
||||
|
||||
# 只认真实的 SpacetimeDB 启动进程,避免 .spacetimedb 路径让 grep/awk 自身误命中。
|
||||
if ((name == "spacetime" || name == "spacetimedb-cli") && index(args, root_dir) > 0) {
|
||||
print user " " pid " " ppid " " stat " " name " " args
|
||||
}
|
||||
}
|
||||
' || true
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,24 @@ Get-CimInstance Win32_Process |
|
||||
fi
|
||||
|
||||
if command -v ps >/dev/null 2>&1; then
|
||||
ps -ef 2>/dev/null | grep '[s]pacetime' | grep -F "${root_dir}" || true
|
||||
ps -eo user=,pid=,ppid=,stat=,comm=,args= 2>/dev/null | awk -v root_dir="${root_dir}" '
|
||||
{
|
||||
user = $1
|
||||
pid = $2
|
||||
ppid = $3
|
||||
stat = $4
|
||||
command = $5
|
||||
args = $0
|
||||
sub(/^[[:space:]]*[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]*/, "", args)
|
||||
name = command
|
||||
sub(/^.*\//, "", name)
|
||||
|
||||
# 只认真实的 SpacetimeDB 启动进程,避免 .spacetimedb 路径让 grep/awk 自身误命中。
|
||||
if ((name == "spacetime" || name == "spacetimedb-cli") && index(args, root_dir) > 0) {
|
||||
print user " " pid " " ppid " " stat " " name " " args
|
||||
}
|
||||
}
|
||||
' || true
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user