Print and capture the output of a subprocess simultaneously
Project description
Print and capture the output of a subprocess simultaneously
$pip install subprocess-print-and-capture
from subprocess_print_and_capture import execute_subprocess
cmd = r"""adb shell getevent -l"""
results = execute_subprocess(cmd, exit_keys="ctrl+e", end_of_printline="")
#output on screen
add device 1: /dev/input/event3
name: "fts"
add device 2: /dev/input/event2
name: "STM VL53L1 proximity sensor"
add device 3: /dev/input/event1
name: "qwerty"
add device 4: /dev/input/event0
name: "gpio_keys"
/dev/input/event3: EV_KEY BTN_TOUCH DOWN
/dev/input/event3: EV_ABS ABS_MT_TRACKING_ID 00001830
/dev/input/event3: EV_ABS ABS_MT_POSITION_X 00000299
/dev/input/event3: EV_ABS ABS_MT_POSITION_Y 000006f5
/dev/input/event3: EV_ABS ABS_MT_TOUCH_MAJOR 00000040
/dev/input/event3: EV_ABS ABS_MT_TOUCH_MINOR 00000030
/dev/input/event3: EV_ABS ABS_MT_PRESSURE 0000000d
/dev/input/event3: EV_SYN SYN_REPORT 00000000
/dev/input/event3: EV_ABS ABS_MT_TOUCH_MAJOR 00000080
/dev/input/event3: EV_ABS ABS_MT_TOUCH_MINOR 00000080
/dev/input/event3: EV_ABS ABS_MT_PRESSURE 00000022
/dev/input/event3: EV_SYN SYN_REPORT 00000000
/dev/input/event3: EV_ABS ABS_MT_TOUCH_MINOR 00000070
/dev/input/event3: EV_ABS ABS_MT_PRESSURE 00000028
/dev/input/event3: EV_SYN SYN_REPORT 00000000
/dev/input/event3: EV_ABS ABS_MT_PRESSURE 0000002a
....
results
Out[3]:
['add device 1: /dev/input/event3\n',
' name: "fts"\n',
'add device 2: /dev/input/event2\n',
' name: "STM VL53L1 proximity sensor"\n',
'add device 3: /dev/input/event1\n',
' name: "qwerty"\n',
'add device 4: /dev/input/event0\n',
' name: "gpio_keys"\n',
'/dev/input/event3: EV_KEY BTN_TOUCH DOWN \n',
'/dev/input/event3: EV_ABS ABS_MT_TRACKING_ID 00001830 \n',
'/dev/input/event3: EV_ABS ABS_MT_POSITION_X 00000299 \n',
'/dev/input/event3: EV_ABS ABS_MT_POSITION_Y 000006f5 \n',
'/dev/input/event3: EV_ABS ABS_MT_TOUCH_MAJOR 00000040 \n',
'/dev/input/event3: EV_ABS ABS_MT_TOUCH_MINOR 00000030 \n',
'/dev/input/event3: EV_ABS ABS_MT_PRESSURE 0000000d \n',
'/dev/input/event3: EV_SYN SYN_REPORT 00000000 \n',
'/dev/input/event3: EV_ABS ABS_MT_TOUCH_MAJOR 00000080 \n',
'/dev/input/event3: EV_ABS ABS_MT_TOUCH_MINOR 00000080 \n',
'/dev/input/event3: EV_ABS ABS_MT_PRESSURE 00000022 \n',
'/dev/input/event3: EV_SYN SYN_REPORT 00000000 \n',
'/dev/input/event3: EV_ABS ABS_MT_TOUCH_MINOR 00000070 \n',
'/dev/input/event3: EV_ABS ABS_MT_PRESSURE 00000028 \n',
'/dev/input/event3: EV_SYN SYN_REPORT 00000000 \n',
'/dev/input/event3: EV_ABS ABS_MT_PRESSURE 0000002a \n',
'/dev/input/event3: EV_SYN SYN_REPORT 00000000 \n',
'/dev/input/event3: EV_ABS ABS_MT_POSITION_X 0000029a \n',
'/dev/input/event3: EV_ABS ABS_MT_POSITION_Y 000006f4 \n',
'/dev/input/event3: EV_ABS ABS_MT_TOUCH_MINOR 00000080 \n',
'/dev/input/event3: EV_ABS ABS_MT_PRESSURE 0000002c \n',
....
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for subprocess_print_and_capture-0.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb1716d30f585931bc42ecb63b5a65216b8c4d17843f667460e0bbcc1f0fcf7d |
|
MD5 | 375ae8823329e88f90530de84c8a9188 |
|
BLAKE2b-256 | 504ad8d353e573e89e734e765ea8283e86f368b024896c44733d3d5153036975 |
Close
Hashes for subprocess_print_and_capture-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ba36544d350b1d3301a9e12d066869d70d91abc4a15a157eec61127b41d1e15 |
|
MD5 | 515b85b2be68bd2a05af9599599760a7 |
|
BLAKE2b-256 | 607e13547b51186fab656bdcf87e659502823868f8e0f40f71907ce722bef6b8 |