adb: fix test_sighup. am: 470622f064 am: 8baf1198ee am: 48ba39854e
am: 7617a039f6
Change-Id: I7b966d56a6fa9ebef5e9725c2518d25e6c844a9b
diff --git a/adb/test_device.py b/adb/test_device.py
index ac7cf3b..02a16e4 100644
--- a/adb/test_device.py
+++ b/adb/test_device.py
@@ -522,13 +522,14 @@
trap "echo SIGINT > {path}; exit 0" SIGINT
trap "echo SIGHUP > {path}; exit 0" SIGHUP
echo Waiting
- while true; do sleep 100; done
+ read
""".format(path=log_path)
script = ";".join([x.strip() for x in script.strip().splitlines()])
- process = self.device.shell_popen(
- ["sh", "-c", "'{}'".format(script)], kill_atexit=False, stdout=subprocess.PIPE)
+ process = self.device.shell_popen([script], kill_atexit=False,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE)
self.assertEqual("Waiting\n", process.stdout.readline())
process.send_signal(signal.SIGINT)
@@ -536,7 +537,7 @@
# Waiting for the local adb to finish is insufficient, since it hangs
# up immediately.
- time.sleep(0.25)
+ time.sleep(1)
stdout, _ = self.device.shell(["cat", log_path])
self.assertEqual(stdout.strip(), "SIGHUP")