mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
Use /proc/$$/stat instead of $PPID.
Summary: $PPID is not available on old shells. Reviewers: tberghammer, ovyalov Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10968 llvm-svn: 241486
This commit is contained in:
@@ -158,7 +158,10 @@ class GdbRemoteTestCaseBase(TestBase):
|
||||
# Remote platforms don't support named pipe based port negotiation
|
||||
use_named_pipe = False
|
||||
|
||||
pid = run_shell_cmd("echo $PPID")
|
||||
# Grab the ppid from /proc/[shell pid]/stat
|
||||
shell_stat = run_shell_cmd("cat /proc/$$/stat")
|
||||
# [pid] ([executable]) [state] [*ppid*]
|
||||
pid = re.match(r"^\d+ \(.+\) . (\d+)", shell_stat).group(1)
|
||||
ls_output = run_shell_cmd("ls -l /proc/%s/exe" % pid)
|
||||
exe = ls_output.split()[-1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user