librelist archives

« back to archive

Works on Ubuntu but not Windows 7

Works on Ubuntu but not Windows 7

From:
David MacAfee
Date:
2012-12-14 @ 07:11
I have been using red Shoes policeman.
I am having a problem getting stdout returned from the shell to Shoes.
It doesn't work on windows 7 but it does work on Ununtu 12.10.
It does work on green Shoes on Windows 7 but I get newlines after every
para as well as checkboxes and other things. Red Shoes doesn't do
this. Either getting stdout back in windows 7 red shoes or not having
newlines without asking for them in green shoes would solve my problem. I
love shoes. Thanks for any help.
Here is the code:

#require 'green_shoes'
require 'Open3'
Shoes.app do

stdin, stdout, stderr = Open3.popen3('echo hello')
para stdout.gets
para %x[echo hello]
para `echo hello 2>&1`
para "Should have said hello three times by now"
end #app

Re: [shoes] Works on Ubuntu but not Windows 7

From:
Cecil Coupe
Date:
2012-12-14 @ 07:55
David,

   When you shell out to the system, then you are dependent on the 
syntax/semantics of the shell you invoke. Win 7 and Unix shells are not 
similar. Windows tends to send cr and lf at the end of lines and unix 
only sends lf. Shoes can't handle those kinds of differences for shell 
calls. It it was correct for Green/Win7, it might be wrong for Red/Linux 
or Green/Linux or OSX/Purple.

It gets worse if you read the docs on popen() and race conditions or 
stalls are to be expected. Not to mention shell commands and arguments 
that aren't universal. E.g.  compare 'ping' for between Win7 and Ubuntu. 
You can't use the same shell command line for both Win7 and Ubuntu.

You have to check RUBY_PLATFORM to decide what the shell command should 
be and how to process any lines or the results from the shell.





On 12/14/2012 12:11 AM, David MacAfee wrote:
> I have been using red Shoes policeman.
> I am having a problem getting stdout returned from the shell to Shoes.
> It doesn't work on windows 7 but it does work on Ununtu 12.10.
> It does work on green Shoes on Windows 7 but I get newlines after every
> para as well as checkboxes and other things. Red Shoes doesn't do
> this. Either getting stdout back in windows 7 red shoes or not having
> newlines without asking for them in green shoes would solve my problem.
> I love shoes. Thanks for any help.
> Here is the code:
>
> #require 'green_shoes'
> require 'Open3'
> Shoes.app do
>
> stdin, stdout, stderr = Open3.popen3('echo hello')
> para stdout.gets
> para %x[echo hello]
> para `echo hello 2>&1`
> para "Should have said hello three times by now"
> end #app

Re: [shoes] Works on Ubuntu but not Windows 7

From:
David MacAfee
Date:
2012-12-14 @ 08:16
I hate it when I don't make myself clear. Sorry about that. I will try
again.
echo works on the command line in windows the same as on linux.
When I run the program on windows I get nil returned. I don't get hello
like I should.
The documentation for red shoes says this should work. I tried red shoes on
linux
and it works. I tried green shoes on windows and it works. Checking
RUBY_PLATFORM
would allow me to put out a message saying this program doesn't work on
this platform.
This isn't the result I am looking for.

The extra linefeeds are a separate problem. Green shoes on windows gives a
linefeed
where Red Shoes on windows  didn't. Here is an example of the problem:

para "foo"
para "bar"

In Red Shoes the out would be:
foobar

In Green Shoes I am getting:
foo
bar

David


On Thu, Dec 13, 2012 at 11:55 PM, Cecil Coupe <ccoupe@cableone.net> wrote:

> David,
>
>    When you shell out to the system, then you are dependent on the
> syntax/semantics of the shell you invoke. Win 7 and Unix shells are not
> similar. Windows tends to send cr and lf at the end of lines and unix
> only sends lf. Shoes can't handle those kinds of differences for shell
> calls. It it was correct for Green/Win7, it might be wrong for Red/Linux
> or Green/Linux or OSX/Purple.
>
> It gets worse if you read the docs on popen() and race conditions or
> stalls are to be expected. Not to mention shell commands and arguments
> that aren't universal. E.g.  compare 'ping' for between Win7 and Ubuntu.
> You can't use the same shell command line for both Win7 and Ubuntu.
>
> You have to check RUBY_PLATFORM to decide what the shell command should
> be and how to process any lines or the results from the shell.
>
>
>
>
>
> On 12/14/2012 12:11 AM, David MacAfee wrote:
> > I have been using red Shoes policeman.
> > I am having a problem getting stdout returned from the shell to Shoes.
> > It doesn't work on windows 7 but it does work on Ununtu 12.10.
> > It does work on green Shoes on Windows 7 but I get newlines after every
> > para as well as checkboxes and other things. Red Shoes doesn't do
> > this. Either getting stdout back in windows 7 red shoes or not having
> > newlines without asking for them in green shoes would solve my problem.
> > I love shoes. Thanks for any help.
> > Here is the code:
> >
> > #require 'green_shoes'
> > require 'Open3'
> > Shoes.app do
> >
> > stdin, stdout, stderr = Open3.popen3('echo hello')
> > para stdout.gets
> > para %x[echo hello]
> > para `echo hello 2>&1`
> > para "Should have said hello three times by now"
> > end #app
>
>

Re: [shoes] Works on Ubuntu but not Windows 7

From:
Cecil Coupe
Date:
2012-12-14 @ 08:13
I forgot to mention the work around/hack.
   See chomp() in the Ruby doc.



On 12/14/2012 12:11 AM, David MacAfee wrote:
> I have been using red Shoes policeman.
> I am having a problem getting stdout returned from the shell to Shoes.
> It doesn't work on windows 7 but it does work on Ununtu 12.10.
> It does work on green Shoes on Windows 7 but I get newlines after every
> para as well as checkboxes and other things. Red Shoes doesn't do
> this. Either getting stdout back in windows 7 red shoes or not having
> newlines without asking for them in green shoes would solve my problem.
> I love shoes. Thanks for any help.
> Here is the code:
>
> #require 'green_shoes'
> require 'Open3'
> Shoes.app do
>
> stdin, stdout, stderr = Open3.popen3('echo hello')
> para stdout.gets
> para %x[echo hello]
> para `echo hello 2>&1`
> para "Should have said hello three times by now"
> end #app

Re: [shoes] Works on Ubuntu but not Windows 7

From:
David MacAfee
Date:
2012-12-14 @ 08:24
Chomp will remove unwanted stuff at the end of a string.
If I do this:

para "foo".chomp
para "bar"

In Red Shoes I get:
foobar

In Green Shoes I get:
foo
bar

David


On Fri, Dec 14, 2012 at 12:13 AM, Cecil Coupe <ccoupe@cableone.net> wrote:

> I forgot to mention the work around/hack.
>    See chomp() in the Ruby doc.
>
>
>
> On 12/14/2012 12:11 AM, David MacAfee wrote:
> > I have been using red Shoes policeman.
> > I am having a problem getting stdout returned from the shell to Shoes.
> > It doesn't work on windows 7 but it does work on Ununtu 12.10.
> > It does work on green Shoes on Windows 7 but I get newlines after every
> > para as well as checkboxes and other things. Red Shoes doesn't do
> > this. Either getting stdout back in windows 7 red shoes or not having
> > newlines without asking for them in green shoes would solve my problem.
> > I love shoes. Thanks for any help.
> > Here is the code:
> >
> > #require 'green_shoes'
> > require 'Open3'
> > Shoes.app do
> >
> > stdin, stdout, stderr = Open3.popen3('echo hello')
> > para stdout.gets
> > para %x[echo hello]
> > para `echo hello 2>&1`
> > para "Should have said hello three times by now"
> > end #app
>
>

Re: [shoes] Works on Ubuntu but not Windows 7

From:
David MacAfee
Date:
2012-12-15 @ 00:11
I figured out my newline problem. I needed to read and understand the
documentation.
Green Shoes TextBlocks need explicit width. Without it it uses parent.width.

David


On Fri, Dec 14, 2012 at 12:24 AM, David MacAfee <david.macafee@gmail.com>wrote:

> Chomp will remove unwanted stuff at the end of a string.
> If I do this:
>
> para "foo".chomp
> para "bar"
>
> In Red Shoes I get:
> foobar
>
> In Green Shoes I get:
> foo
> bar
>
> David
>
>
> On Fri, Dec 14, 2012 at 12:13 AM, Cecil Coupe <ccoupe@cableone.net> wrote:
>
>> I forgot to mention the work around/hack.
>>    See chomp() in the Ruby doc.
>>
>>
>>
>> On 12/14/2012 12:11 AM, David MacAfee wrote:
>> > I have been using red Shoes policeman.
>> > I am having a problem getting stdout returned from the shell to Shoes.
>> > It doesn't work on windows 7 but it does work on Ununtu 12.10.
>> > It does work on green Shoes on Windows 7 but I get newlines after every
>> > para as well as checkboxes and other things. Red Shoes doesn't do
>> > this. Either getting stdout back in windows 7 red shoes or not having
>> > newlines without asking for them in green shoes would solve my problem.
>> > I love shoes. Thanks for any help.
>> > Here is the code:
>> >
>> > #require 'green_shoes'
>> > require 'Open3'
>> > Shoes.app do
>> >
>> > stdin, stdout, stderr = Open3.popen3('echo hello')
>> > para stdout.gets
>> > para %x[echo hello]
>> > para `echo hello 2>&1`
>> > para "Should have said hello three times by now"
>> > end #app
>>
>>
>