Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different behavior between block/non-blocking command #69

Open
wgjak47 opened this issue Feb 21, 2019 · 0 comments
Open

different behavior between block/non-blocking command #69

wgjak47 opened this issue Feb 21, 2019 · 0 comments

Comments

@wgjak47
Copy link

wgjak47 commented Feb 21, 2019

Python 3.6.5 (default, Apr 30 2018, 17:28:45) 
[GCC 6.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import delegator
>>> delegator.run(["ls", "-ltr"])
<Command ['ls', '-ltr']>
>>> print(_.out)
3c38c29667ff92da48efe096a4d02c33-{87A94AB0-E370-4cde-98D3-ACC110C5967D}
dumps
firefox_wgjak47
gameoverlayui.log
gameoverlayui.log.last
mozilla_wgjak470
pulse-PKdhtXMmr18n
qipc_sharedmemory_vWeJlNKttqulwtsFWhvgjgMWyIsoUBcfPzegfIa531e59614117c87604f08fdce98ed6992f41dc2
qipc_systemsem_vWeJlNKttqulwtsFWhvgjgMWyIsoUBcfPzegfIa531e59614117c87604f08fdce98ed6992f41dc2
sddm-:0-admhzy
sddm-authf2cc6c54-ef27-41fb-aba4-4dd0983682e8
shadowsocks-qt5
ssh-YGJKpV2GglPo
steam_chrome_shmem_uid1000_spid8462
systemd-private-114fd641e43147049112b5c15f993361-mysqld.service-sFGecH
systemd-private-114fd641e43147049112b5c15f993361-rtkit-daemon.service-XWxi6M
systemd-private-114fd641e43147049112b5c15f993361-systemd-timesyncd.service-B0qmOs
systemd-private-114fd641e43147049112b5c15f993361-upower.service-4UBov1
Temp-932171ac-0b62-481b-8b6e-2f5e6d6e17e7
Temp-93e13b39-61d7-4834-a29f-e5e7c37902ab
vWeJlNK33ttqulwt_sFWhvgjgMWyIsoUBcfPze5g6fI=
xauth-1000-_0

>>> delegator.run(["ls", "-ltr"], block=False)
<Command ['ls', '-ltr']>
>>> _.block()
>>> print(_.out)
总用量 12
drwx------ 3 root    root     60 2月  21 18:39 systemd-private-114fd641e43147049112b5c15f993361-systemd-timesyncd.service-B0qmOs
drwx------ 2 root    root     40 2月  21 18:39 pulse-PKdhtXMmr18n
drwx------ 3 root    root     60 2月  21 18:39 systemd-private-114fd641e43147049112b5c15f993361-mysqld.service-sFGecH
srwxr-xr-x 1 root    root      0 2月  21 18:39 sddm-authf2cc6c54-ef27-41fb-aba4-4dd0983682e8
srwx------ 1 sddm    sddm      0 2月  21 18:39 sddm-:0-admhzy
drwx------ 2 wgjak47 wgjak47  60 2月  21 18:39 ssh-YGJKpV2GglPo
-rw------- 1 wgjak47 wgjak47 177 2月  21 18:39 xauth-1000-_0
drwx------ 3 root    root     60 2月  21 18:39 systemd-private-114fd641e43147049112b5c15f993361-upower.service-4UBov1
drwx------ 3 root    root     60 2月  21 18:39 systemd-private-114fd641e43147049112b5c15f993361-rtkit-daemon.service-XWxi6M
srwxrwxrwx 1 wgjak47 wgjak47   0 2月  21 18:39 shadowsocks-qt5
drwx------ 2 wgjak47 wgjak47  40 2月  21 18:39 Temp-932171ac-0b62-481b-8b6e-2f5e6d6e17e7
srwx------ 1 wgjak47 wgjak47   0 2月  21 18:39 vWeJlNK33ttqulwt_sFWhvgjgMWyIsoUBcfPze5g6fI=
-rw-r----- 1 wgjak47 wgjak47   0 2月  21 18:39 qipc_systemsem_vWeJlNKttqulwtsFWhvgjgMWyIsoUBcfPzegfIa531e59614117c87604f08fdce98ed6992f41dc2
-rw-r----- 1 wgjak47 wgjak47   0 2月  21 18:39 qipc_sharedmemory_vWeJlNKttqulwtsFWhvgjgMWyIsoUBcfPzegfIa531e59614117c87604f08fdce98ed6992f41dc2
srwxr-xr-x 1 wgjak47 wgjak47   0 2月  21 18:41 steam_chrome_shmem_uid1000_spid8462
drwxrwxrwx 2 wgjak47 wgjak47 100 2月  21 19:15 dumps
-rw-r--r-- 1 wgjak47 wgjak47 712 2月  21 19:22 gameoverlayui.log.last
-rw-r--r-- 1 wgjak47 wgjak47 637 2月  21 19:49 gameoverlayui.log
drwx------ 2 wgjak47 wgjak47  40 2月  21 19:59 Temp-93e13b39-61d7-4834-a29f-e5e7c37902ab
srwxr-xr-x 1 wgjak47 wgjak47   0 2月  21 20:21 3c38c29667ff92da48efe096a4d02c33-{87A94AB0-E370-4cde-98D3-ACC110C5967D}
drwx------ 2 wgjak47 wgjak47  40 2月  21 21:19 mozilla_wgjak470
drwx------ 2 wgjak47 wgjak47  60 2月  21 21:43 firefox_wgjak47

>>> 

Look like the same problem in #58

I guess the non block mode use pexpect and block mode use subprocess directly...

And when use subprocess with shell=True, the list[1:] will be ignored....

The packages version:

delegator.py==0.1.1
  - pexpect [required: >=4.1.0, installed: 4.6.0]
    - ptyprocess [required: >=0.5, installed: 0.6.0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant