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

Output of Shell command is captured in wrong order. #6645

Closed
phuoctai-huynh opened this issue Jul 21, 2016 · 2 comments
Closed

Output of Shell command is captured in wrong order. #6645

phuoctai-huynh opened this issue Jul 21, 2016 · 2 comments
Labels
- Bug tracker - Should report upstream stale marked as a stale issue/pr (usually by a bot)

Comments

@phuoctai-huynh
Copy link

Description

Output of the print sp.call(["ls", "-l"]) is placed on the top of buffer Messages. But this line is the fourth line of print in the python script. This is inconsistent with output order when executing on terminal.

Reproduction guide

  • Start Emacs
  • SPC ! and execute command python test_cmd.py

test_cmd.py

import subprocess as sp
print sp.Popen("export TZ=':Etc/GMT-6';date +%z", shell=True, stdout=sp.PIPE).stdout.read()
print sp.Popen("TZ='Etc/GMT-6' date +%z", shell=True, stdout=sp.PIPE).stdout.read()
child = sp.Popen("export TZ='Etc/GMT-6'; date +%z", shell=True, stdout=sp.PIPE)
rc = child.returncode
print rc
print sp.call(["ls", "-l"])
print sp.call("exit 1", shell=True)
print "End"

Observed behaviour:
Buffer Messages shows

total 813
-rwxrwxrwx 1 root root 830539 Jun 30 18:15 Python_Programming.pdf
-rwxrwxrwx 1 root root 470 Jul 21 12:42 test_cmd.py
-rwxrwxrwx 1 root root 131 Jun 9 2015 tips.txt
+0600
+0600
None
0
1
End

Expected behaviour:
If this script is run on terminal, output order will be as below

+0600
+0600
None
total 813
-rwxrwxrwx 1 root root 830539 Jun 30 18:15 Python_Programming.pdf
-rwxrwxrwx 1 root root 470 Jul 21 12:42 test_cmd.py
-rwxrwxrwx 1 root root 131 Jun 9 2015 tips.txt
0
1
End

System Info

  • OS: gnu/linux
  • Emacs: 24.5.1
  • Spacemacs: 0.105.21
  • Spacemacs branch: master (rev. 0283f64)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(auto-completion better-defaults emacs-lisp git markdown org
                 (colors :variables colors-enable-nyan-cat-progress-bar t)
                 (shell :variables shell-default-height 30 shell-default-position 'bottom)
                 syntax-checking version-control semantic c-c   themes-megapack gtags taihuynh)

Backtrace


@bmag
Copy link
Contributor

bmag commented Jul 21, 2016

Using Emacs 25.0.95 and latest develop branch, I can confirm this behavior, BUT: I experience the same behavior with stock Emacs:

  • start stock Emacs: emacs -Q
  • M-! and execute command python test_cmd.py

So I don't think there's much we can do. I suggest searching the web and Emacs' bug tracker for this issue, and if you don't find anything you can report a bug to Emacs by calling M-x report-emacs-bug.

Observed behaviour:
Buffer Messages shows [...]

Note: for me the output is shown in the *Shell Command Output*, not the messages buffer. The messages buffer is a different buffer called *Messages*.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Bug tracker - Should report upstream stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

3 participants