* M-x term on Windows
@ 2015-10-23 3:51 Random832
2015-10-23 7:21 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Random832 @ 2015-10-23 3:51 UTC (permalink / raw)
To: help-gnu-emacs
When I run M-x term in Windows, it doesn't work. If I let it run
cmdproxy, it prints the startup message and prompt but accepts no
input. If I run any other program (e.g. the interactive python
interpreter), I don't even get that.
M-x shell is adequate for running command-line commands, but I would
like a terminal to be able to run a ssh client (plink?) in. Has anyone
else managed to find a solution for this problem?
M-x list-processes shows some elaborate sh script:
/bin/sh -c stty -nl echo rows 23 columns 80 sane 2>/dev/null;if [ $1 =
.. ]; then shift; fi; exec "$@" .. c:\Python34\python.exe
I remember installing Git bash in C:\bin\sh.exe to try to make this
work, but didn't follow up with doing anything about stty or /dev/null
etc.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: M-x term on Windows
2015-10-23 3:51 M-x term on Windows Random832
@ 2015-10-23 7:21 ` Eli Zaretskii
2015-10-28 14:40 ` Random832
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2015-10-23 7:21 UTC (permalink / raw)
To: help-gnu-emacs
> From: Random832 <random832@fastmail.com>
> Date: Thu, 22 Oct 2015 23:51:58 -0400
>
> When I run M-x term in Windows, it doesn't work. If I let it run
> cmdproxy, it prints the startup message and prompt but accepts no
> input. If I run any other program (e.g. the interactive python
> interpreter), I don't even get that.
term.el in its present form cannot be run on MS-Windows. It has too
much staff hardcoded that assumes a Posix shell in /bin/sh and a
terminal driver that supports Posix features like stty settings and
SGR escape sequences. You _might_ be able to tweak it to work with
MSYS Bash instead, although even that could bump into basic
incompatibilities between MSYS and native Windows programs. One other
gotcha is that on Windows, subprocesses are run via pipes, not via a
pty, so SGR sequences will probably never work, because a pipe fails
the isatty test, and the shell doesn't think it's connected to a
terminal, as it does on Unix.
Patches are welcome, of course, if you succeed in making that work.
> M-x shell is adequate for running command-line commands, but I would
> like a terminal to be able to run a ssh client (plink?) in.
Plink is a native Windows program, so it doesn't need 'term'. You
should be able to run it from "M-x shell".
> I remember installing Git bash in C:\bin\sh.exe to try to make this
> work, but didn't follow up with doing anything about stty or /dev/null
> etc.
Git comes with a part of MSYS, but my suggestion is to install a full
MSYS installation, instead of relying on Git, because some parts might
be missing in Git (those that are not needed for running Git's
scripts).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: M-x term on Windows
[not found] <mailman.851.1445572367.7904.help-gnu-emacs@gnu.org>
@ 2015-10-23 18:11 ` Javier
0 siblings, 0 replies; 5+ messages in thread
From: Javier @ 2015-10-23 18:11 UTC (permalink / raw)
To: help-gnu-emacs
Random832 <random832@fastmail.com> wrote:
>
> When I run M-x term in Windows, it doesn't work. If I let it run
> cmdproxy, it prints the startup message and prompt but accepts no
> input. If I run any other program (e.g. the interactive python
> interpreter), I don't even get that.
>
> M-x shell is adequate for running command-line commands, but I would
> like a terminal to be able to run a ssh client (plink?) in. Has anyone
> else managed to find a solution for this problem?
Did you try emacs under cygwin? The emacs-w32 package under cygwin
should run as a windows application without needing an X server.
http://superuser.com/questions/229544/running-emacs-in-cygwin/577632#577632
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: M-x term on Windows
2015-10-23 7:21 ` Eli Zaretskii
@ 2015-10-28 14:40 ` Random832
2015-10-28 16:11 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Random832 @ 2015-10-28 14:40 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
> term.el in its present form cannot be run on MS-Windows. It has too
> much staff hardcoded that assumes a Posix shell in /bin/sh and a
> terminal driver that supports Posix features like stty settings and
> SGR escape sequences.
SGR escape sequences have nothing to do with the terminal driver, they
are provided by emacs itself. Did you mean the expectation that the
programs running inside it will emit them? I thought this was implicit
in my statement that I was going to use it for ssh (to a GNU/Linux
machine).
I have made some progress... as far as I can tell, the assumption is
mostly isolated to the start-process call site itself, and simply
ripping it out and having it start plink directly (I currently have a
hardcoded path and am ignoring the user-entered command - this isn't
nearly ready to submit a patch) works fine.
The key factor that makes it work for this use case is that the stty
settings are mostly all handled by the remote host - plink just shovels
a stream of bytes back and forth. Unlike git (MSYS?) openssh, it doesn't
care if its own standard I/O streams are pipes and is willing to open a
remote pty regardless.
The other annoyance I have run into is that I have to run the "resize"
command (supplied with xterm) manually - once at login and then after
any change, to detect the window size. I couldn't find anywhere in the
code to react to changes (e.g. by calling stty rows/cols again), and
there aren't any hooks in plink to handle this anyway. The environment
variables such as TERM also aren't propagated to the remote host, but
that seems to be plink's fault.
> Plink is a native Windows program, so it doesn't need 'term'. You
> should be able to run it from "M-x shell".
But M-x shell can't handle escape sequences.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: M-x term on Windows
2015-10-28 14:40 ` Random832
@ 2015-10-28 16:11 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2015-10-28 16:11 UTC (permalink / raw)
To: help-gnu-emacs
> From: Random832 <random832@fastmail.com>
> Date: Wed, 28 Oct 2015 10:40:47 -0400
>
> Eli Zaretskii <eliz@gnu.org> writes:
> > term.el in its present form cannot be run on MS-Windows. It has too
> > much staff hardcoded that assumes a Posix shell in /bin/sh and a
> > terminal driver that supports Posix features like stty settings and
> > SGR escape sequences.
>
> SGR escape sequences have nothing to do with the terminal driver, they
> are provided by emacs itself. Did you mean the expectation that the
> programs running inside it will emit them?
Yes, the latter.
> I thought this was implicit in my statement that I was going to use
> it for ssh (to a GNU/Linux machine).
In that case, I've misunderstood to think you want to run a local
shell. (You mentioned Bash that comes with Git, which led me to that
conclusion.)
> The key factor that makes it work for this use case is that the stty
> settings are mostly all handled by the remote host - plink just shovels
> a stream of bytes back and forth. Unlike git (MSYS?) openssh, it doesn't
> care if its own standard I/O streams are pipes and is willing to open a
> remote pty regardless.
AFAIU, plink doesn't assume it will run in full-screen mode, it's
basically a batch-mode ssh client. So indeed it doesn't care about
the devices it is connected to.
> The other annoyance I have run into is that I have to run the "resize"
> command (supplied with xterm) manually - once at login and then after
> any change, to detect the window size. I couldn't find anywhere in the
> code to react to changes (e.g. by calling stty rows/cols again), and
> there aren't any hooks in plink to handle this anyway. The environment
> variables such as TERM also aren't propagated to the remote host, but
> that seems to be plink's fault.
See above. PuTTY does this, but I won't expect that from plink.
> > Plink is a native Windows program, so it doesn't need 'term'. You
> > should be able to run it from "M-x shell".
>
> But M-x shell can't handle escape sequences.
Right.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-28 16:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-23 3:51 M-x term on Windows Random832
2015-10-23 7:21 ` Eli Zaretskii
2015-10-28 14:40 ` Random832
2015-10-28 16:11 ` Eli Zaretskii
[not found] <mailman.851.1445572367.7904.help-gnu-emacs@gnu.org>
2015-10-23 18:11 ` Javier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).