stop emitter after 1 second

I have a feeling this is an easy thing, but I cant seem to figure it out. I have a car that I want to emit a small cloud of exhaust when you hold down the gas button. This part is working fine. However I would like to limit the emitter time to just 1 or 2 seconds. So each time you hit the gas button you get a poof of exhaust.

Here is my code. No errors, it just doesn’t stop emitting after 1 second.

var emitter : ParticleEmitter;

 
function Update () {
    exhaustEmitter ();
}

function exhaustEmitter (){
 if(Input.GetKey("w")){
          emitter.emit = true;
          yield WaitForSeconds(1);
     }
     else{
     emitter.emit = false;
     }
}

try this- the trick is to track whether you’ve emitted for this press yet, and also to turn your emitter off after the yield

    var emitter : ParticleEmitter;
     var hasEmittedThisGasPress = false;
         
     function Update () 
     {
         exhaustEmitter ();
     }
         
    function exhaustEmitter ()
    {
        if(Input.GetKey("w"))
        {
             if( !hasEmittedThisGasPress )
             {
                  hasEmittedThisGasPress = true;
                  emitter.emit = true;
                  yield WaitForSeconds(1);
                  emitter.emit = false;
             }
        }
        else
        {
             hasEmittedThisGasPress = false;
             emitter.emit = false;
        }
}

You can try to do this without a code:
In Inspector set duration to 1.00 and untick the Looping flag.