rschmitt / heatseeker

A high-performance Selecta clone, written in Rust.
MIT License
214 stars 10 forks source link

Cygwin build can't see STDIN #15

Closed muellerj closed 9 years ago

muellerj commented 9 years ago

The compile completes just fine, however when I call the resulting binary later, it doesn't see to get the input string I pass it via STDIN:

projects/heatseeker [3d|master*] cargo build --release
   Compiling libc v0.1.10
   Compiling unicode-width v0.1.3
   Compiling winapi v0.2.2
   Compiling winapi-build v0.1.1
   Compiling num_cpus v0.2.6
   Compiling log v0.3.1
   Compiling kernel32-sys v0.1.4
   Compiling getopts v0.2.13
   Compiling time v0.1.32
   Compiling heatseeker v1.3.0 (file:///C:/Users/q284114/projects/heatseeker)
projects/heatseeker [3d|master*] cp target/release/hs.exe ~/bin
‘target/release/hs.exe’ -> ‘/cygdrive/c/Users/muellerj/bin/hs.exe’
projects/heatseeker [3d|master*] which hs
/cygdrive/c/Users/muellerj/bin/hs
projects/heatseeker [3d|master*] echo "foo\nbar\baz" | hs

  [ Here, nothing is displayed, I eventually kill it with ^C ]

projects/heatseeker [3d|master*] hs --help
Usage: C:\Users\muellerj\bin\hs.exe [options]

Options:
    -h, --help          Show this message
    -v, --version       Show version
    -s, --search [SEARCH]
                        Specify an initial search string
    -f, --first         Automatically select the first match
    -F, --full-screen   Use the entire screen in order to display as many
                        choices as possible
muellerj commented 9 years ago

If you need details about the Cygwin environment, please let me know!

rschmitt commented 9 years ago

What's the output of --version?

muellerj commented 9 years ago

I'll be back at the Windows workstation on Monday to check. The build output says 1.3.0?

rschmitt commented 9 years ago

I'm more interested in the target triple.

muellerj commented 9 years ago

Sure! This is what I get:

~ [7d|master] ~/bin/hs --version
heatseeker 1.3.0 single-threaded (baa2351) (built 2015-08-28 10:59:36 +0100 for x86_64-pc-windows-gnu)
rschmitt commented 9 years ago

I wouldn't expect that to work. That's the actual Windows executable, and it needs to talk directly to the Windows API to manipulate the screen. (That's how the Windows console works. It's not a character stream like POSIX terminals are.) You need to build hs for Cygwin.

muellerj commented 9 years ago

Sorry if this is a silly question, but how would I tell cargo build to do so?

rschmitt commented 9 years ago

I'm not sure. I think you'd have to build your own rustc within Cygwin, or find a binary that somebody else built.

On Mon, Aug 31, 2015 at 12:03 PM, Jonas Müller notifications@github.com wrote:

Sorry if this is a silly question, but how would I tell cargo build to do so?

— Reply to this email directly or view it on GitHub https://github.com/rschmitt/heatseeker/issues/15#issuecomment-136468099.

rschmitt commented 9 years ago

It's a long shot, but have you tried just using the musl linux build within Cygwin?

On Mon, Aug 31, 2015 at 12:20 PM, Ryan Schmitt rschmitt@pobox.com wrote:

I'm not sure. I think you'd have to build your own rustc within Cygwin, or find a binary that somebody else built.

On Mon, Aug 31, 2015 at 12:03 PM, Jonas Müller notifications@github.com wrote:

Sorry if this is a silly question, but how would I tell cargo build to do so?

— Reply to this email directly or view it on GitHub https://github.com/rschmitt/heatseeker/issues/15#issuecomment-136468099 .

muellerj commented 9 years ago

I have not, but I see how that's a problem concerning rust under Cygwin. The official docs say Cygwin ist not officially supported:

0.3 Does it run on Windows? Yes. All development happens in lockstep on all 3 target platforms (using MinGW, not Cygwin).

(from https://doc.rust-lang.org/complement-lang-faq.html)

I'll try around some more and keep this issue up-to-date if I find something, but close this issue for now.