public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Does not work well: rlwrap + rxvt + cmd
@ 2011-08-24 15:07 Ronald Fischer
  2011-08-24 15:15 ` Eliot Moss
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Ronald Fischer @ 2011-08-24 15:07 UTC (permalink / raw)
  To: cygwin

I would like to run cmd.exe within a rxvt terminal on Windows 7. Problem
is that calling the cmd.exe 
command history does not work (it seems that the cursor keys are not
passed properly to cmd.exe). 

In one thread in this mailing list, it was recommended to wrap the rxvt
call by rlwrap:

  rlwrap rxvt -e cmd.exe

However, this doesn't solve the problem.

Any other suggestions? Maybe any alternative to the standard Windows
console? On Windows XP
I used the sourceforge-project Console2, but on Windows 7 it crashes so
often, that I am looking
for a different solution.

In particular, I like with rxvt (and with Console2) the ease of copyiing
and pasting text, in
particular text spanning more than one line.

Ronald
-- 
Ronald Fischer <ronaldf@eml.cc>
+  If a packet hits a pocket on a socket on a port, 
+  and the bus is interrupted and the interrupt's not caught,
+  then the socket packet pocket has an error to report.
+		(cited after Peter van der Linden)


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Does not work well: rlwrap + rxvt + cmd
  2011-08-24 15:07 Does not work well: rlwrap + rxvt + cmd Ronald Fischer
@ 2011-08-24 15:15 ` Eliot Moss
  2011-08-25  7:34   ` Ronald Fischer
  2011-08-24 15:16 ` Charles Wilson
  2011-08-24 15:40 ` Andrew DeFaria
  2 siblings, 1 reply; 12+ messages in thread
From: Eliot Moss @ 2011-08-24 15:15 UTC (permalink / raw)
  To: cygwin

Just a quick thought, but I think you may
want to run rlwrap within rxvt, something like:

rxvt rlwrap cmd.exe

but maybe with some flags, etc.

Regards -- ELiot Moss

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Does not work well: rlwrap + rxvt + cmd
  2011-08-24 15:07 Does not work well: rlwrap + rxvt + cmd Ronald Fischer
  2011-08-24 15:15 ` Eliot Moss
@ 2011-08-24 15:16 ` Charles Wilson
  2011-08-24 15:40 ` Andrew DeFaria
  2 siblings, 0 replies; 12+ messages in thread
From: Charles Wilson @ 2011-08-24 15:16 UTC (permalink / raw)
  To: cygwin

On 8/24/2011 11:07 AM, Ronald Fischer wrote:
> I would like to run cmd.exe within a rxvt terminal

rlwrap is not the problem.  Running 'cmd.exe' within rxvt is not
possible; cmd.exe expects direct access to the console host (csrss on
WinVista-; conhost.exe on Win7+).  That is, it expects that functions
like those listed here:
http://msdn.microsoft.com/en-us/library/ms682073%28v=vs.85%29.aspx
such as ReadConsoleInput or WriteConsoleOutput will work.

rxvt is not what windows expects as a console host. It is a terminal
emulator, and basically communicates with the inferior (bash, etc) via
stdio pipes, and unix-style signals.

rxvt + cmd.exe won't work.

--
Chuck


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Does not work well: rlwrap + rxvt + cmd
  2011-08-24 15:07 Does not work well: rlwrap + rxvt + cmd Ronald Fischer
  2011-08-24 15:15 ` Eliot Moss
  2011-08-24 15:16 ` Charles Wilson
@ 2011-08-24 15:40 ` Andrew DeFaria
  2011-08-24 15:52   ` Ronald of Steiermark
  2 siblings, 1 reply; 12+ messages in thread
From: Andrew DeFaria @ 2011-08-24 15:40 UTC (permalink / raw)
  To: cygwin

On 08/24/11 08:07, Ronald Fischer wrote:
> I would like to run cmd.exe within a rxvt terminal on Windows 7.
My question is why? Why do you want to run cmd.exe?
> Problem is that calling the cmd.exe command history does not work (it 
> seems that the cursor keys are not passed properly to cmd.exe).
>
> In one thread in this mailing list, it was recommended to wrap the 
> rxvt call by rlwrap:
>
> rlwrap rxvt -e cmd.exe
>
> However, this doesn't solve the problem.
>
> Any other suggestions?
My suggestion would be to abandon cmd.exe altogether. This is not some 
smug response or anything like that. Simply put, I have not found a 
single thing that I need to have cmd.exe around to do it. In fact the 
only time I go into cmd.exe is to proof to others "See it fails in 
straight cmd.exe too".

I also find the cmd shell and command language inferior in that there's 
nothing special or even convenient in cmd that can't be done even 
quicker and better in bash. Now that's a subjective opinion and can be 
considered smug but it's held with literally years of using Cygwin and 
Unix/Linux systems together. It's demonstrable that scripts you might 
develop for bash under Cygwin work equally as well if you simply move 
them onto say Linux, Solaris, HP-UX, FreeBSD, etc. (sans the obvious 
non-portable things you might do with Cygwin specific executables like 
cygpath as well as Windows pathnames or other assumptions. Suffice to 
say, however, that you can program in that portability). I know - I do 
it all the time.

Given the above I must question again - why do you want to run cmd.exe?
> Maybe any alternative to the standard Windows console? On Windows XP I 
> used the sourceforge-project Console2, but on Windows 7 it crashes so 
> often, that I am looking for a different solution.
>
> In particular, I like with rxvt (and with Console2) the ease of 
> copyiing and pasting text, in particular text spanning more than one 
> line. 
I used rxvt for a long time. I too enjoy the copy and paste semantics 
and the ability to resize the term and it just works correctly. 
Additionally rxvt pays attention to ~/.Xdefaults settings which is 
convenient. However I've since switched to mintty. You should check it out.

As the other guy said, I don't think that running cmd.exe will work with 
the arrows because cmd.exe is expecting access to the console in a 
"Windows way". That said, and if you're hellbent on using cmd.exe, I 
vaguely recall another terminal emulator program (not a Cygwin thing 
mind you) called, I believe just "Terminal" (Good luck googling that!) 
which (insert fuzzy memory here) I believe used a hidden cmd console 
window to allow the Windows program the proper console environment while 
translating that to the non-hidden Terminal window. That might work...
-- 
Andrew DeFaria <http://defaria.com>
It's not an optical illusion. It just looks like one.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Does not work well: rlwrap + rxvt + cmd
  2011-08-24 15:40 ` Andrew DeFaria
@ 2011-08-24 15:52   ` Ronald of Steiermark
  2011-08-24 15:56     ` Eliot Moss
  2011-08-24 16:04     ` Andrew DeFaria
  0 siblings, 2 replies; 12+ messages in thread
From: Ronald of Steiermark @ 2011-08-24 15:52 UTC (permalink / raw)
  To: Andrew DeFaria, cygwin

On Wed, 24 Aug 2011 08:39 -0700, "Andrew DeFaria" <Andrew@DeFaria.com>
wrote:
> > I would like to run cmd.exe within a rxvt terminal on Windows 7.
> My question is why? Why do you want to run cmd.exe?

For instance, to test the cruel BAT files which we are going to deliver.

> I also find the cmd shell and command language inferior 

Language? I wouldn't even call this crap a "language"...

> in that there's 
> nothing special or even convenient in cmd that can't be done even 
> quicker and better in bash. 

Yep, though right now I'm fancying zsh.

But we are all slaves to those who pay us...

> That said, and if you're hellbent on using cmd.exe, I 
> vaguely recall another terminal emulator program (not a Cygwin thing 
> mind you) called, I believe just "Terminal" (Good luck googling that!) 
> which (insert fuzzy memory here) I believe used a hidden cmd console 
> window to allow the Windows program the proper console environment while 
> translating that to the non-hidden Terminal window. That might work...

Thanks a lot, will look it up.

Ronald
-- 
Ronald Fischer <austria_rules@yepmail.net>

There are 10 types of people in the world: those who understand binary and those who don't.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Does not work well: rlwrap + rxvt + cmd
  2011-08-24 15:52   ` Ronald of Steiermark
@ 2011-08-24 15:56     ` Eliot Moss
  2011-08-25  7:51       ` Ronald Fischer
  2011-08-24 16:04     ` Andrew DeFaria
  1 sibling, 1 reply; 12+ messages in thread
From: Eliot Moss @ 2011-08-24 15:56 UTC (permalink / raw)
  To: cygwin

On 8/24/2011 11:52 AM, Ronald of Steiermark wrote:
> On Wed, 24 Aug 2011 08:39 -0700, "Andrew DeFaria"<Andrew@DeFaria.com>
> wrote:

> For instance, to test the cruel BAT files which we are going to deliver.

You can run .bat files from bash and other Cygwin shells.

You can also invoke DOS / Windows programs directly.

In both cases you generally to present Windows paths, of course;
cygpath can help with that.

Best -- Eliot Moss

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Does not work well: rlwrap + rxvt + cmd
  2011-08-24 15:52   ` Ronald of Steiermark
  2011-08-24 15:56     ` Eliot Moss
@ 2011-08-24 16:04     ` Andrew DeFaria
  2011-08-25  7:54       ` Ronald of Steiermark
  1 sibling, 1 reply; 12+ messages in thread
From: Andrew DeFaria @ 2011-08-24 16:04 UTC (permalink / raw)
  To: cygwin

On 08/24/11 08:52, Ronald of Steiermark wrote:
> On Wed, 24 Aug 2011 08:39 -0700, "Andrew DeFaria"<Andrew@DeFaria.com>
> wrote:
>>> I would like to run cmd.exe within a rxvt terminal on Windows 7.
>> My question is why? Why do you want to run cmd.exe?
> For instance, to test the cruel BAT files which we are going to deliver.
How 'bout: $ cmd /c cruel.bat

? Would you really need more?

I don't know. I stay way from .bat files...
>
>> I also find the cmd shell and command language inferior
> Language? I wouldn't even call this crap a "language"...
I was being kind.
>
>> in that there's
>> nothing special or even convenient in cmd that can't be done even
>> quicker and better in bash.
> Yep, though right now I'm fancying zsh.
Where it makes sense, it's always good to go with what a lot of people 
go with. How many Solaris machines have zsh installed?
>
> But we are all slaves to those who pay us...
I pay myself! I'm incorporated and I employ myself. I hate being my own 
slave but it does have it's advantages. The "boss", however, can be a 
real a-hole if you know what I mean! ;-)
>
>> That said, and if you're hellbent on using cmd.exe, I
>> vaguely recall another terminal emulator program (not a Cygwin thing
>> mind you) called, I believe just "Terminal" (Good luck googling that!)
>> which (insert fuzzy memory here) I believe used a hidden cmd console
>> window to allow the Windows program the proper console environment while
>> translating that to the non-hidden Terminal window. That might work...
> Thanks a lot, will look it up.
>
> Ronald


-- 
Andrew DeFaria <http://defaria.com>
The big difference between sex for money and sex for free Is that sex 
for money usually costs a lot less!


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Does not work well: rlwrap + rxvt + cmd
  2011-08-24 15:15 ` Eliot Moss
@ 2011-08-25  7:34   ` Ronald Fischer
  0 siblings, 0 replies; 12+ messages in thread
From: Ronald Fischer @ 2011-08-25  7:34 UTC (permalink / raw)
  To: Eliot Moss, cygwin

On Wed, 24 Aug 2011 11:15 -0400, "Eliot Moss" <moss@cs.umass.edu> wrote:
> Just a quick thought, but I think you may
> want to run rlwrap within rxvt, something like:
> 
> rxvt rlwrap cmd.exe

Thanks a lot! Indeed,

   rxvt -e rlwrap cmd

Ronald
-- 
Ronald Fischer <ronaldf@eml.cc>
+  If a packet hits a pocket on a socket on a port, 
+  and the bus is interrupted and the interrupt's not caught,
+  then the socket packet pocket has an error to report.
+		(cited after Peter van der Linden)


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Does not work well: rlwrap + rxvt + cmd
  2011-08-24 15:56     ` Eliot Moss
@ 2011-08-25  7:51       ` Ronald Fischer
  2011-08-25 17:46         ` Andrew DeFaria
  0 siblings, 1 reply; 12+ messages in thread
From: Ronald Fischer @ 2011-08-25  7:51 UTC (permalink / raw)
  To: Eliot Moss, cygwin

On Wed, 24 Aug 2011 11:56 -0400, "Eliot Moss" <moss@cs.umass.edu> wrote:
> On 8/24/2011 11:52 AM, Ronald of Steiermark wrote:
> > On Wed, 24 Aug 2011 08:39 -0700, "Andrew DeFaria"<Andrew@DeFaria.com>
> > wrote:
> 
> > For instance, to test the cruel BAT files which we are going to deliver.
> 
> You can run .bat files from bash and other Cygwin shells.

You can *run* them, but the effect is not always the same. 

For example, setting an environment variable within a batch file under
CMD.EXE results in the environment variable being visible in the calling
environment (similar to "sourcing" a file in bash), while calling the
batch file from bash leaves the environment intact. 

Also, some internal commands (for example COPY) are not present in bash,
though this can be easily remedied using an alias or a shell function.

Other problems are related to the use of \ as a path separator. Imagine
that some of your BATCH files generate environment variables containing
a Windows path, 
and simply because bash command lines are interpreted differently than
Windows CMD command line (for example, when it comes to quoting or
parameter substitution).

The main problem, however, is: If you are going to deliver something,
which is supposed to run under CMD.EXE,  most customers won't accept it
until you really have tested it under CMD.EXE, and for good reason. In
fact, even though I got running rxvt with cmd thanks to all the
suggestions to my post, I will do some *final* tests  still in plain,
native Windoze Command-Windows, just for the safe side.

Using a bash shell as a "main work horse" is great, but when you have
the pleasure to create and test batch files, you will sooner or later be
happy to also have a CMD shell available...

> In both cases you generally to present Windows paths, of course;
> cygpath can help with that.

I use cygpath in several of my scripts and it's extremely useful, but
dealing with the various path representations in interactive work is,
for me at least, an annoyance...

Thank you for your suggestions, though!

Ronald
-- 
Ronald Fischer <ronaldf@eml.cc>
+  If a packet hits a pocket on a socket on a port, 
+  and the bus is interrupted and the interrupt's not caught,
+  then the socket packet pocket has an error to report.
+		(cited after Peter van der Linden)


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Does not work well: rlwrap + rxvt + cmd
  2011-08-24 16:04     ` Andrew DeFaria
@ 2011-08-25  7:54       ` Ronald of Steiermark
  2011-08-25 17:37         ` Andrew DeFaria
  0 siblings, 1 reply; 12+ messages in thread
From: Ronald of Steiermark @ 2011-08-25  7:54 UTC (permalink / raw)
  To: Andrew DeFaria, cygwin

On Wed, 24 Aug 2011 09:03 -0700, "Andrew DeFaria" <Andrew@DeFaria.com>
wrote:
> On 08/24/11 08:52, Ronald of Steiermark wrote:
> > Yep, though right now I'm fancying zsh.
> Where it makes sense, it's always good to go with what a lot of people 
> go with. How many Solaris machines have zsh installed?

All of them I've seen so far ;-)

Of course I am aware that there are also plenty Solaris hosts out there
where the admin hasn't bother to install it.

Ronald
-- 
Ronald Fischer <austria_rules@yepmail.net>

There are 10 types of people in the world: those who understand binary and those who don't.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Does not work well: rlwrap + rxvt + cmd
  2011-08-25  7:54       ` Ronald of Steiermark
@ 2011-08-25 17:37         ` Andrew DeFaria
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew DeFaria @ 2011-08-25 17:37 UTC (permalink / raw)
  To: cygwin

On 8/25/2011 12:53 AM, Ronald of Steiermark wrote:
> On Wed, 24 Aug 2011 09:03 -0700, "Andrew DeFaria"<Andrew@DeFaria.com>
> wrote:
>> On 08/24/11 08:52, Ronald of Steiermark wrote:
>>> Yep, though right now I'm fancying zsh.
>> Where it makes sense, it's always good to go with what a lot of people
>> go with. How many Solaris machines have zsh installed?
> All of them I've seen so far ;-)
>
> Of course I am aware that there are also plenty Solaris hosts out there
> where the admin hasn't bother to install it.
The question is whether or not it is installed by default. Many shops 
only install defaults. Often getting something non-default is like 
pulling teeth.
-- 
Andrew DeFaria <http://defaria.com>
Why is bra singular and panties plural?


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Does not work well: rlwrap + rxvt + cmd
  2011-08-25  7:51       ` Ronald Fischer
@ 2011-08-25 17:46         ` Andrew DeFaria
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew DeFaria @ 2011-08-25 17:46 UTC (permalink / raw)
  To: cygwin

On 8/25/2011 12:51 AM, Ronald Fischer wrote:
> On Wed, 24 Aug 2011 11:56 -0400, "Eliot Moss"<moss@cs.umass.edu>  wrote:
>> On 8/24/2011 11:52 AM, Ronald of Steiermark wrote:
>>> On Wed, 24 Aug 2011 08:39 -0700, "Andrew DeFaria"<Andrew@DeFaria.com>
>>> wrote:
>>> For instance, to test the cruel BAT files which we are going to deliver.
>> You can run .bat files from bash and other Cygwin shells.
> You can *run* them, but the effect is not always the same.
>
> For example, setting an environment variable within a batch file under
> CMD.EXE results in the environment variable being visible in the calling
> environment (similar to "sourcing" a file in bash), while calling the
> batch file from bash leaves the environment intact.
This behavior is well known. However why does it matter? Are you saying 
that you have to "source" a .bat file to set up the environment and then 
execute another .bat file that requires those environment settings??? 
I'm not saying this doesn't happen but it's not a very good practice.
> Also, some internal commands (for example COPY) are not present in bash,
> though this can be easily remedied using an alias or a shell function.
Why should this be an issue? I mean if you exec some .bat file and it 
calls "copy" does it not work?
> Other problems are related to the use of \ as a path separator. Imagine
> that some of your BATCH files generate environment variables containing
> a Windows path,
Again, why is this a problem? If your .bat file has "copy 
C:\Windows\some.dll C:\Temp" does it  not work? Or are you saying that 
you may need to do from bash:

$ some.bat <Windows path>

If this is there are a lot of solutions including cygpath, doubling 
backslashes, quoting file names or just using forward slashes (which 
Windows often works just fine with).
> and simply because bash command lines are interpreted differently than
> Windows CMD command line (for example, when it comes to quoting or
> parameter substitution).
We all know that bash interprets things the bash way. And  no doubt cmd 
interprets things it's way. I do not see cmd's interpretation as superior.
> The main problem, however, is: If you are going to deliver something,
> which is supposed to run under CMD.EXE,  most customers won't accept it
> until you really have tested it under CMD.EXE, and for good reason.
That's where:

$ cmd /c somescript.bat

comes in. That does run it under cmd.exe doesn't it? Why do you need 
anything more? Why do you need to enter multiple commands and have 
command history? Why not simply:

$ cmd /c testscript1.bat
<verify output>
$ # That worked!
$ cmd /c testscript2.bat
<verify output>
$ # That worked too...
$ # etc...
> In fact, even though I got running rxvt with cmd thanks to all the
> suggestions to my post, I will do some *final* tests  still in plain,
> native Windoze Command-Windows, just for the safe side.
>
> Using a bash shell as a "main work horse" is great, but when you have
> the pleasure to create and test batch files, you will sooner or later be
> happy to also have a CMD shell available...
Just re-write your .bat scripts in Perl! ;-)
>
>> In both cases you generally to present Windows paths, of course;
>> cygpath can help with that.
> I use cygpath in several of my scripts and it's extremely useful, but
> dealing with the various path representations in interactive work is,
> for me at least, an annoyance...
It's really  not that hard. Just s/\\/\/g! That often is enough. Or do a 
cygpath -w <posix path> or whatever.
-- 
Andrew DeFaria <http://defaria.com>
My wife keeps complaining I never listen to her ...or something like that.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

end of thread, other threads:[~2011-08-25 17:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-24 15:07 Does not work well: rlwrap + rxvt + cmd Ronald Fischer
2011-08-24 15:15 ` Eliot Moss
2011-08-25  7:34   ` Ronald Fischer
2011-08-24 15:16 ` Charles Wilson
2011-08-24 15:40 ` Andrew DeFaria
2011-08-24 15:52   ` Ronald of Steiermark
2011-08-24 15:56     ` Eliot Moss
2011-08-25  7:51       ` Ronald Fischer
2011-08-25 17:46         ` Andrew DeFaria
2011-08-24 16:04     ` Andrew DeFaria
2011-08-25  7:54       ` Ronald of Steiermark
2011-08-25 17:37         ` Andrew DeFaria

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).