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
diff --git a/lldb/test/tools/lldb-server/gdbremote_testcase.py b/lldb/test/tools/lldb-server/gdbremote_testcase.py
index c81dd10..c3a1cca 100644
--- a/lldb/test/tools/lldb-server/gdbremote_testcase.py
+++ b/lldb/test/tools/lldb-server/gdbremote_testcase.py
@@ -158,7 +158,10 @@
# 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]