title: Laravel 'sudo: no tty' error on Artisan::call when clearing cache from varnish
body: <p>I followed this <a href="https://github.com/spatie/laravel-varnish" rel="nofollow noreferrer">Git repo</a></p>
  
  <p>Everything worked fine.</p>
  
  <p>I can be able to issue <code>php artisan varnish:flush</code> from SSH.</p>
  
  <p>but when I tried to flush cache from script i was getting error as </p>
  
  <p><strong>sudo: no tty present and no askpass program specified</strong></p>
  
  <p>This is how I added in routes.php</p>
  
  <pre><code>Route::get('/flush', function() {
      Artisan::call('varnish:flush');
  });
  </code></pre>
  
  <p>and I also Tried </p>
  
  <pre><code>Route::get('/flush', function() {
      (new Spatie\Varnish\Varnish())-&gt;flush();
  });
  </code></pre>
  
  <p>This is how complete error looks.</p>
  
  <pre><code>ProcessFailedException in Varnish.php line 64:
  The command "sudo varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 'ban req.http.host ~ (^www.host.com$)'" failed.
  
  Exit Code: 1(General error)
  
  Working directory: /home/admin/web/host.com/public_html
  
  Output:
  ================
  
  
  Error Output:
  ================
  sudo: no tty present and no askpass program specified
  </code></pre>
  
  <p>I am using Vesta CP Over VPS.</p>
  
  <p>Find Me A Solution to solve this error..</p>