File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1173,6 +1173,13 @@ void Context::staticInitialization() {
1173
1173
void Context::createDefaultConfig () {
1174
1174
// Do we need to create a default rc?
1175
1175
if (rc_file._data != " " && !rc_file.exists ()) {
1176
+ // If stdout is not a file, we are probably executing in a completion context and should not
1177
+ // prompt (as the user won't see it) or modify the config (as completion functions are typically
1178
+ // read-only).
1179
+ if (!isatty (STDOUT_FILENO)) {
1180
+ throw std::string (" Cannot proceed without rc file." );
1181
+ }
1182
+
1176
1183
if (config.getBoolean (" confirmation" ) &&
1177
1184
!confirm (format (" A configuration file could not be found in {1}\n\n Would you like a sample "
1178
1185
" {2} created, so Taskwarrior can proceed?" ,
You can’t perform that action at this time.
0 commit comments