all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* On Windows(R) Emacs «shell» mode doesn't prints an output.
@ 2014-09-24 20:07 Hi-Angel
  2014-09-25  7:43 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Hi-Angel @ 2014-09-24 20:07 UTC (permalink / raw
  To: help-gnu-emacs

When I am working on Windows, I am using Emacs «shell» mode. The
problem is that it sometimes doesn't prints an applications output
(more precisely prints only after the app died).
The problem is present exclusively in Emacs, e.g. if I am run an
application in Windows® native terminal, it is works fine.

I thought that the problem is in encoding, and set «shell»'s buffer
with «C-x <RET> f» to UTF-16, which, as I know, uses MS, but it didn't
fixed the problem.

Below is a simple example of an application that won't print an output in Emacs:

#include <cstdio>
#include <cstring>

int main(){
    puts("Hello, enter something");
    char buf[256];
    memset(buf, 0, sizeof(buf));
    fgets(buf, sizeof(buf)-1, stdin);
    puts(buf);
    return 0;
}

This works fine in both GNU/Linux, and the terminal of Windows®, but
not in Emacs shell mode on Windowsor.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: On Windows(R) Emacs «shell» mode doesn't prints an output.
       [not found] <mailman.9514.1411591630.1147.help-gnu-emacs@gnu.org>
@ 2014-09-25  6:32 ` Pascal J. Bourguignon
  0 siblings, 0 replies; 6+ messages in thread
From: Pascal J. Bourguignon @ 2014-09-25  6:32 UTC (permalink / raw
  To: help-gnu-emacs

Hi-Angel <hiangel999@gmail.com> writes:

> When I am working on Windows, I am using Emacs «shell» mode. The
> problem is that it sometimes doesn't prints an applications output
> (more precisely prints only after the app died).
> The problem is present exclusively in Emacs, e.g. if I am run an
> application in Windows® native terminal, it is works fine.
>
> I thought that the problem is in encoding, and set «shell»'s buffer
> with «C-x <RET> f» to UTF-16, which, as I know, uses MS, but it didn't
> fixed the problem.

1- this is not an emacs problem.

2- this is a basic programming question, that dates back since the dawn
   of computing.

3- what the fuck are you taught in school?


> Below is a simple example of an application that won't print an output in Emacs:
>
> #include <cstdio>
> #include <cstring>
>
> int main(){
>     puts("Hello, enter something");
>     char buf[256];
>     memset(buf, 0, sizeof(buf));
>     fgets(buf, sizeof(buf)-1, stdin);
>     puts(buf);
>     return 0;
> }
>
> This works fine in both GNU/Linux, and the terminal of Windows®, 

By pure chance.

> but not in Emacs shell mode on Windowsor.


YOU FORGOT TO FLUSH YOUR BUFFERS!

man 3 fflush

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: On Windows(R) Emacs «shell» mode doesn't prints an output.
  2014-09-24 20:07 Hi-Angel
@ 2014-09-25  7:43 ` Eli Zaretskii
  2014-09-25  8:25   ` Yuri Khan
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2014-09-25  7:43 UTC (permalink / raw
  To: help-gnu-emacs

> Date: Thu, 25 Sep 2014 00:07:09 +0400
> From: Hi-Angel <hiangel999@gmail.com>
> 
> When I am working on Windows, I am using Emacs «shell» mode. The
> problem is that it sometimes doesn't prints an applications output
> (more precisely prints only after the app died).
> The problem is present exclusively in Emacs, e.g. if I am run an
> application in Windows® native terminal, it is works fine.

Emacs on Windows redirects the shell's standard handles to a pipe, and
pipes on Windows are fully-buffered (as opposed to line-buffering for
the console device).  So if your program doesn't flush its standard
output frequently enough, you may see this problem.

> I thought that the problem is in encoding, and set «shell»'s buffer
> with «C-x <RET> f» to UTF-16, which, as I know, uses MS, but it didn't
> fixed the problem.

Console applications on Windows use the current OEM codepage, not
UTF-16.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: On Windows(R) Emacs «shell» mode doesn't prints an output.
  2014-09-25  7:43 ` Eli Zaretskii
@ 2014-09-25  8:25   ` Yuri Khan
  2014-09-25  8:44     ` Hi-Angel
  2014-09-25  8:55     ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Yuri Khan @ 2014-09-25  8:25 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: help-gnu-emacs@gnu.org

On Thu, Sep 25, 2014 at 2:43 PM, Eli Zaretskii <eliz@gnu.org> wrote:

>> I thought that the problem is in encoding, and set «shell»'s buffer
>> with «C-x <RET> f» to UTF-16, which, as I know, uses MS, but it didn't
>> fixed the problem.
>
> Console applications on Windows use the current OEM codepage, not
> UTF-16.

This is correct in general, although *some* Windows console
applications can be persuaded to output in UTF-16. (The only example I
know of is cmd.exe /U.)

Also, there is an unofficial unsupported ugly hack to use “chcp 65001”
which makes applications think that the current OEM codepage is UTF-8.
(It is unsupported because that there is some code that assumes at
most two bytes for each character, while UTF-8 may produce up to
four.)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: On Windows(R) Emacs «shell» mode doesn't prints an output.
  2014-09-25  8:25   ` Yuri Khan
@ 2014-09-25  8:44     ` Hi-Angel
  2014-09-25  8:55     ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Hi-Angel @ 2014-09-25  8:44 UTC (permalink / raw
  To: help-gnu-emacs

Dear Pascal J. Bourguignon, no need for an abuses, don't be a
barbarian. I am always heard and was sure that the buffers flushes on
a «newline». That's weird to me that it is wrong, but after your words
I googled, and found that this is indeed a truth. Thx anyway for the
answer, I surely wouldn't found it soon by myself.


>> When I am working on Windows, I am using Emacs «shell» mode. The
>> problem is that it sometimes doesn't prints an applications output
>> (more precisely prints only after the app died).
>> The problem is present exclusively in Emacs, e.g. if I am run an
>> application in Windows® native terminal, it is works fine.
>>
>> I thought that the problem is in encoding, and set «shell»'s buffer
>> with «C-x <RET> f» to UTF-16, which, as I know, uses MS, but it didn't
>> fixed the problem.
>
>1- this is not an emacs problem.
>
>2- this is a basic programming question, that dates back since the dawn
   >of computing.
>
>3- what the fuck are you taught in school?
>
>
>> Below is a simple example of an application that won't print an output in Emacs:
>>
>> #include <cstdio>
>> #include <cstring>
>>
>> int main(){
>>     puts("Hello, enter something");
>>     char buf[256];
>>     memset(buf, 0, sizeof(buf));
>>     fgets(buf, sizeof(buf)-1, stdin);
>>     puts(buf);
>>     return 0;
>> }
>>
>> This works fine in both GNU/Linux, and the terminal of Windows®,
>
>By pure chance.
>
>> but not in Emacs shell mode on Windowsor.
>
>
>YOU FORGOT TO FLUSH YOUR BUFFERS!



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: On Windows(R) Emacs «shell» mode doesn't prints an output.
  2014-09-25 15:44               ` Yuri Khan
@ 2014-09-25 16:26                 ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2014-09-25 16:26 UTC (permalink / raw
  To: help-gnu-emacs

> Date: Thu, 25 Sep 2014 22:44:51 +0700
> From: Yuri Khan <yuri.v.khan@gmail.com>
> Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
> 
> >> Lucida Console is not the only font which is usable in the Windows
> >> console. See, for example, MS Gothic:
> >>
> >> http://www.microsoft.com/typography/fonts/font.aspx?FMID=2145
> >
> > I don't see this font in the list of fonts you can select in the
> > Property sheets of the cmd prompt on Windows XP and on Windows 7.  On
> > XP, I can only select Lucida Console; on Windows 7 I can also select
> > Consolas (whose coverage is slightly larger, and includes Thai, but
> > still does not include CJK.
> 
> http://blogs.msdn.com/b/oldnewthing/archive/2007/05/16/2659903.aspx
> and the MSDN article linked from there.

You cannot expect your users to do such things, many of them won't.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-09-25 16:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.9514.1411591630.1147.help-gnu-emacs@gnu.org>
2014-09-25  6:32 ` On Windows(R) Emacs «shell» mode doesn't prints an output Pascal J. Bourguignon
2014-09-24 20:07 Hi-Angel
2014-09-25  7:43 ` Eli Zaretskii
2014-09-25  8:25   ` Yuri Khan
2014-09-25  8:44     ` Hi-Angel
2014-09-25  8:55     ` Eli Zaretskii
2014-09-25 10:18       ` Yuri Khan
2014-09-25 11:19         ` Eli Zaretskii
2014-09-25 12:16           ` Yuri Khan
2014-09-25 13:31             ` Eli Zaretskii
2014-09-25 15:44               ` Yuri Khan
2014-09-25 16:26                 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.