Comments (10)
Update
Simple Fix: Use proper, system-specific file descriptors. See #28.
from curlie.
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.
from curlie.
Just pushed a new release, please try the 1.3.0 and tell me if it's better.
from curlie.
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.
from curlie.
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.
from curlie.
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?
from curlie.
Ok
from curlie.
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?
from curlie.
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.
from curlie.
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.
from curlie.
Related Issues (20)
- Incorrect version info in `--version` HOT 2
- Support nested JSON
- curl option --aws-sigv4 values get interpreted as headers HOT 1
- Allow disabling reading from `stdin` HOT 3
- Swap windows release extension to .zip
- Supply default options via environment variable
- application/json accept header included even when no data passed
- Feature Request: Session Support HOT 3
- Same command works in curlie but not in curl HOT 1
- Add in OS Linux distributions other than ArchLinux HOT 1
- JSONRPC request failing with HTTP/0.9 not allowed
- Please bump golang.org/x/sys dependency
- Custom color scheme support?
- [Windows] fatal error: all goroutines are asleep - deadlock! HOT 4
- panic: close of closed channel
- Inquiry about Integrating Curlie Documentation into tldr HOT 2
- Deadlock with --version flag HOT 5
- `--compressed` flag required for curlie but not regular curl
- HTTPie JSON array syntax doesn’t work
- Pagination flag
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from curlie.