Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any tips to get it running on windows 10? #12

Closed
johnmhm opened this issue Dec 2, 2019 · 10 comments
Closed

Any tips to get it running on windows 10? #12

johnmhm opened this issue Dec 2, 2019 · 10 comments

Comments

@johnmhm
Copy link

johnmhm commented Dec 2, 2019

Downloaded the amd64 binary, and have a working curl in path, but curlie http://site.tld just hangs indefinitely.

@rs
Copy link
Owner

rs commented Dec 2, 2019

Just pushed a new release, please try the 1.3.0 and tell me if it's better.

@johnmhm
Copy link
Author

johnmhm commented Dec 2, 2019

Issue persists unfortunately. Here's the output of -V if that helps:

C:\Users\johnmhm>curlie -V
curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
Release-Date: [unreleased]
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL

It hangs after the last line, and needs ctrl-c to return to a command line.

@coolaj86
Copy link
Contributor

coolaj86 commented Jul 15, 2020

I'm noticing the same thing. I'm on a recent Windows 10 release on a Virtual Machine (virtualbox).

The built-in curl.exe is working without a problem.

@coolaj86
Copy link
Contributor

If we remove x/crypto/ssh/terminal and just assume a terminal, it works as expected.

This is possibly a bug that should be filed with that package against Windows.

diff --git a/main.go b/main.go
index c3746cf..9f62d13 100644
--- a/main.go
+++ b/main.go
@@ -12,7 +12,6 @@ import (

        "github.com/rs/curlie/args"
        "github.com/rs/curlie/formatter"
-       "golang.org/x/crypto/ssh/terminal"
 )

 func main() {
@@ -52,7 +51,7 @@ func main() {
                stdout = &formatter.HelpAdapter{Out: stdout, CmdName: os.Args[0]}
        } else {
                isForm := opts.Has("F")
-               if pretty || terminal.IsTerminal(1) {
+               if pretty || true /*|| terminal.IsTerminal(1)*/ {
                        inputWriter = &formatter.JSON{
                        stdout = &formatter.BinaryFilter{Out: stdout}
                }
-               if pretty || terminal.IsTerminal(2) {
+               if pretty || true /*|| terminal.IsTerminal(2) */ {
                        // If stderr is not redirected, output headers.
                        if !quiet {
                                opts = append(opts, "-v")
@@ -80,7 +79,7 @@ func main() {
                        // If data is provided via -d, read it from there for the verbose mode.
                        // XXX handle the @filename case.
                        inputWriter.Write([]byte(data))
-               } else if !terminal.IsTerminal(0) {
+               } else if false /*!terminal.IsTerminal(0)*/ {
                        // If something is piped in to the command, tell curl to use it as input.
                        opts = append(opts, "-d@-")
                        // Tee the stdin to the buffer used show the posted data in verbose mode.
@@ -118,7 +117,7 @@ func main() {
                Verbose: verbose,
                Post:    input,
        }
-       if (opts.Has("I") || opts.Has("head")) && terminal.IsTerminal(1) {
+       if (opts.Has("I") || opts.Has("head")) && true /* terminal.IsTerminal(1) */ {
                cmd.Stdout = ioutil.Discard
        }
        status := 0

I'd like to propose creating a dummy check for when compiling for Windows. I'd be happy to submit that PR.

Thoughts @rs?

@rs
Copy link
Owner

rs commented Sep 12, 2020

Ok

coolaj86 pushed a commit to coolaj86/curlie that referenced this issue Sep 12, 2020
@coolaj86
Copy link
Contributor

My conclusion from testing is that it is not possible to detect the Terminal properly on Windows 10 through the x/crypto/ssh/terminal package.

curlie when treating cmd.exe as a Terminal, curlie will output some extra junk.

Windows Terminal, unfortunately, is not detected as a proper console, despite behaving as one.

cc/ @jkunkee Re: Windows Terminal: Do you know anyone that could help with this?

coolaj86 pushed a commit to coolaj86/curlie that referenced this issue Sep 12, 2020
@coolaj86
Copy link
Contributor

coolaj86 commented Sep 12, 2020

Update

Simple Fix: Use proper, system-specific file descriptors. See #28.

@rs rs closed this as completed in 5a0fb64 Sep 12, 2020
@bitcrazed
Copy link

Hi. One of Microsoft's Terminal/Console PMs here.

Windows' (legacy) Console has supported a pretty decent range of VT sequences since 2017. The new Windows Terminal much more comprehensive support for VT, and is updated ~monthly.

If Curlie doesn't enable VT mode, and/or emits VT sequences or Unicode glyphs that Console doesn't support, you may see some garbage and/or Unicode placeholder symbols (�).

Curlie should enable Console's VT Processing mode when starting up by grabbing the handle for STDOUT, and calling SetConsoleMode() to ENABLE_VIRTUAL_TERMINAL_PROCESSING. Here's how Curl does it.

If you want to emit Unicode glyphs, you'll need to use the wide char output variants. Again, here's how Curl does it.

FWIW, I am knocking together a small command-line tool ("Paws") that supports VT for colorized output (if available), and monochrome if not.

HTH.

@coolaj86
Copy link
Contributor

Thanks @bitcrazed! That cleared up some of my misconceptions.

I'm glad to hear that Console (default cmd.exe) supports colors after all.

Opening up a new issue #29 to deal specifically with the color issue now that we've got the basic Stdout problem solved that was the root of this original issue.

@bitcrazed
Copy link

Glad to have helped. If you're interested in the history and internals of Console & Windows' command-line, please read through this 5-part blog series. In this series, you'll find, for example, that like Bash, Cmd and PowerShell are simply command-line shells, but that Windows "helps" by creating and attaching a Console instance to them, providing the (now somewhat dated) UI through which you interact with the shells.

Also, note that Console is now largely in maintenance - it'll likely be shipped in Windows for years to come, and may pick up a few improvements here and there, but all new development & new features are being poured into Windows Terminal which I STRONGLY encourage you to use if possible, if you're not already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants