File tree 3 files changed +20
-1
lines changed
3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,15 @@ declare namespace open {
42
42
@default false
43
43
*/
44
44
readonly url ?: boolean ;
45
+
46
+ /**
47
+ Allow the opened app to exit with nonzero exit code when the `wait` option is `true`.
48
+
49
+ We do not recommend setting this option. The convention for success is exit code zero.
50
+
51
+ @default false
52
+ */
53
+ readonly allowNonzeroExitCode ?: boolean ;
45
54
}
46
55
}
47
56
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ module.exports = async (target, options) => {
29
29
wait : false ,
30
30
background : false ,
31
31
url : false ,
32
+ allowNonzeroExitCode : false ,
32
33
...options
33
34
} ;
34
35
@@ -148,7 +149,7 @@ module.exports = async (target, options) => {
148
149
subprocess . once ( 'error' , reject ) ;
149
150
150
151
subprocess . once ( 'close' , exitCode => {
151
- if ( exitCode > 0 ) {
152
+ if ( options . allowNonzeroExitCode && exitCode > 0 ) {
152
153
reject ( new Error ( `Exited with code ${ exitCode } ` ) ) ;
153
154
return ;
154
155
}
Original file line number Diff line number Diff line change @@ -102,6 +102,15 @@ We do not recommend using it on targets that are not URLs.
102
102
103
103
Especially useful when dealing with the [ double-quotes on Windows] ( #double-quotes-on-windows ) caveat.
104
104
105
+ ##### allowNonzeroExitCode
106
+
107
+ Type: ` boolean ` \
108
+ Default: ` false `
109
+
110
+ Allow the opened app to exit with nonzero exit code when the ` wait ` option is ` true ` .
111
+
112
+ We do not recommend setting this option. The convention for success is exit code zero.
113
+
105
114
## Caveats
106
115
107
116
### Double-quotes on Windows
You can’t perform that action at this time.
0 commit comments