Commit bf83b68 1 parent d178a2e commit bf83b68 Copy full SHA for bf83b68
File tree 2 files changed +16
-1
lines changed
src/chocolatey/infrastructure.app
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -110,12 +110,17 @@ Exit codes that normally result from running this command.
110
110
Normal:
111
111
- 0: operation was successful, no issues detected
112
112
- -1 or 1: an error has occurred
113
+ - 2: nothing to do, feature already set (enhanced)
114
+
115
+ NOTE: Starting in v0.10.12, if you have the feature '{0}'
116
+ turned on, then choco will provide enhanced exit codes that allow
117
+ better integration and scripting.
113
118
114
119
If you find other exit codes that we have not yet documented, please
115
120
file a ticket so we can document it at
116
121
https://github.com/chocolatey/choco/issues/new/choose.
117
122
118
- " ) ;
123
+ " . format_with ( ApplicationParameters . Features . UseEnhancedExitCodes ) ) ;
119
124
120
125
"chocolatey" . Log ( ) . Info ( ChocolateyLoggers . Important , "Options and Switches" ) ;
121
126
}
Original file line number Diff line number Diff line change @@ -242,6 +242,11 @@ public void feature_disable(ChocolateyConfiguration configuration)
242
242
else
243
243
{
244
244
this . Log ( ) . Warn ( NO_CHANGE_MESSAGE ) ;
245
+
246
+ if ( configuration . Features . UseEnhancedExitCodes && Environment . ExitCode == 0 )
247
+ {
248
+ Environment . ExitCode = 2 ;
249
+ }
245
250
}
246
251
}
247
252
@@ -268,6 +273,11 @@ public void feature_enable(ChocolateyConfiguration configuration)
268
273
else
269
274
{
270
275
this . Log ( ) . Warn ( NO_CHANGE_MESSAGE ) ;
276
+
277
+ if ( configuration . Features . UseEnhancedExitCodes && Environment . ExitCode == 0 )
278
+ {
279
+ Environment . ExitCode = 2 ;
280
+ }
271
281
}
272
282
}
273
283
You can’t perform that action at this time.
0 commit comments