Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita73476d

Browse files
committed
Get tests passing using pipePty implementation
1 parentc949d44 commita73476d

File tree

7 files changed

+241
-207
lines changed

7 files changed

+241
-207
lines changed

‎cli/login.go‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ func login() *cobra.Command {
4444
returnxerrors.Errorf("has initial user: %w",err)
4545
}
4646
if!hasInitialUser {
47-
if!isTTY(cmd.InOrStdin()) {
48-
returnxerrors.New("the initial user cannot be created in non-interactive mode. use the API")
49-
}
47+
// TODO: Bryan - is this check correct on windows?
48+
// if !isTTY(cmd.InOrStdin()) {
49+
// return xerrors.New("the initial user cannot be created in non-interactive mode. use the API")
50+
// }
5051
_,_=fmt.Fprintf(cmd.OutOrStdout(),"%s Your Coder deployment hasn't been set up!\n",color.HiBlackString(">"))
5152

5253
_,err:=runPrompt(cmd,&promptui.Prompt{

‎expect/conpty/conpty.go‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package conpty
88

99
import (
1010
"fmt"
11+
"io"
1112
"os"
1213

1314
"golang.org/x/sys/windows"
@@ -42,14 +43,22 @@ func (c *ConPty) Close() error {
4243

4344
// OutPipe returns the output pipe of the pseudo terminal
4445
func (c*ConPty)OutPipe()*os.File {
46+
returnc.inPipe
47+
}
48+
49+
func (c*ConPty)Reader() io.Reader {
4550
returnc.outPipe
4651
}
4752

4853
// InPipe returns input pipe of the pseudo terminal
4954
// Note: It is safer to use the Write method to prevent partially-written VT sequences
5055
// from corrupting the terminal
5156
func (c*ConPty)InPipe()*os.File {
52-
returnc.inPipe
57+
returnc.outPipe
58+
}
59+
60+
func (c*ConPty)WriteString(strstring) (int,error) {
61+
returnc.inPipe.WriteString(str)
5362
}
5463

5564
func (c*ConPty)createPseudoConsoleAndPipes()error {

‎expect/console.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ func (c *Console) Send(s string) (int, error) {
217217

218218
// SendLine writes string s to Console's tty with a trailing newline.
219219
func (c*Console)SendLine(sstring) (int,error) {
220-
returnc.Send(fmt.Sprintf("%s\n",s))
220+
bytes,err:=c.Send(fmt.Sprintf("%s\r\n",s))
221+
222+
returnbytes,err
221223
}
222224

223225
// Log prints to Console's logger.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp