This repository was archived by the owner on Aug 22, 2023. It is now read-only.
File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ class LS extends Command {
12
12
dir : flags . string ( {
13
13
char : 'd' ,
14
14
default : process . cwd ( ) ,
15
+ required : true ,
15
16
} ) ,
16
17
}
17
18
@@ -25,4 +26,4 @@ class LS extends Command {
25
26
}
26
27
27
28
LS . run ( )
28
- . catch ( require ( '@oclif/errors/handle' ) )
29
+ . then ( ( ) => { } , require ( '@oclif/errors/handle' ) )
Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ export default abstract class Command {
112
112
const g : any = global
113
113
g [ 'http-call' ] = g [ 'http-call' ] || { }
114
114
g [ 'http-call' ] ! . userAgent = this . config . userAgent
115
+ this . _swallowEPIPE ( )
115
116
if ( this . _helpOverride ( ) ) return this . _help ( )
116
117
}
117
118
@@ -164,4 +165,15 @@ export default abstract class Command {
164
165
this . log ( this . config . userAgent )
165
166
return this . exit ( 0 )
166
167
}
168
+
169
+ /**
170
+ * swallows stdout epipe errors
171
+ * this occurs when stdout closes such as when piping to head
172
+ */
173
+ protected _swallowEPIPE ( ) {
174
+ process . stdout . on ( 'error' , err => {
175
+ if ( err && err . code === 'EPIPE' ) return
176
+ throw err
177
+ } )
178
+ }
167
179
}
You can’t perform that action at this time.
0 commit comments