usually the command might have a --force option to tell the command to proceed without seeking any user input. If you implement this, you can pass --force to the scheduled command?
Is Command's Input->IsInteractive supposed to be "true" during a Schedule run?
Dear Developers,
Thank you very much for the ineffably awesome Community and contributions!
Currently, it's Laravel v10.38 in use, and it'll be upgraded eventually at the server I believe.
Meanwhile, I am trying to execute a command which supports confirmations with $this->confirm('...'), but prior the any prompt, I do check the interactivity with $this->input->isInteractive();. It works if executed with PTY/TTY, i.e. in terminal like ./artisan 'some-command';, yet if I do schedule this exact command in Schedule like:
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
protected function commands(): void
{
$this->load(__DIR__ . '/Commands');
}
protected function schedule(Schedule $schedule): void
{
$schedule->command(Commands\SomeCommand::class)->everyMinute();
}
}
...and then run ./artisan 'schedule:run';, it considers the execution interactive (due to the absence of option no-interaction I presume), and denies any confirmations by default.
Is it expected behavior? Is it expected that $this->input->isInteractive(); returns true during a Schedule run? If so, how would you check whether the command is running inside a schedule and sure consider it non-interactive in such case by default?
Or, is it actually supposed to be scheduled with the option --no-interaction explicitly like?: $schedule->command(Commands\SomeCommand::class, ['--no-interaction'])->everyMinute();.
I would appreciate a suggestion! 🪐
Best and kind regards
Please or to participate in this conversation.