import sys
import subprocess

from vantage import utils
from vantage.exceptions import VantageException


def shell_cmd(env, cmd, *args):
    utils.loquacious(f"Running system defined '{cmd}' inside env", env)
    utils.loquacious(f"  With args: {args}", env)

    try:
        cmd = utils.find_executable(cmd)
        if cmd is None:
            raise FileNotFoundError()
        completed = subprocess.run(
            [cmd, *args],
            env=env,
            stdin=sys.stdin,
            stdout=sys.stdout,
            stderr=sys.stderr,
        )
        utils.loquacious(f"  Exited with code {completed.returncode}", env)
        return completed.returncode
    except FileNotFoundError:
        raise VantageException(f"Command '{cmd}' not found")

import sys
import subprocess

from vantage import utils
from vantage.exceptions import VantageException


def shell_cmd(env, cmd, *args):
    utils.loquacious(f"Running system defined '{cmd}' inside env", env)
    utils.loquacious(f"  With args: {args}", env)

    try:
        cmd_path = utils.find_executable(cmd)
        if cmd_path is None:
            raise FileNotFoundError()
        completed = subprocess.run(
            [cmd_path, *args],
            env=env,
            stdin=sys.stdin,
            stdout=sys.stdout,
            stderr=sys.stderr,
        )
        utils.loquacious(f"  Exited with code {completed.returncode}", env)
        return completed.returncode
    except FileNotFoundError:
        raise VantageException(f"Command '{cmd}' not found")

Fix missing cmd name in error message
Fix missing cmd name in error message

  import sys
  import subprocess
  
  from vantage import utils
  from vantage.exceptions import VantageException
  
  
  def shell_cmd(env, cmd, *args):
      utils.loquacious(f"Running system defined '{cmd}' inside env", env)
      utils.loquacious(f"  With args: {args}", env)
  
      try:
-         cmd = utils.find_executable(cmd)
+         cmd_path = utils.find_executable(cmd)
-         if cmd is None:
+         if cmd_path is None:
              raise FileNotFoundError()
          completed = subprocess.run(
-             [cmd, *args],
+             [cmd_path, *args],
              env=env,
              stdin=sys.stdin,
              stdout=sys.stdout,
              stderr=sys.stderr,
          )
          utils.loquacious(f"  Exited with code {completed.returncode}", env)
          return completed.returncode
      except FileNotFoundError:
          raise VantageException(f"Command '{cmd}' not found")
  
Fix missing cmd name in error message
## Code Before:
import sys
import subprocess

from vantage import utils
from vantage.exceptions import VantageException


def shell_cmd(env, cmd, *args):
    utils.loquacious(f"Running system defined '{cmd}' inside env", env)
    utils.loquacious(f"  With args: {args}", env)

    try:
        cmd = utils.find_executable(cmd)
        if cmd is None:
            raise FileNotFoundError()
        completed = subprocess.run(
            [cmd, *args],
            env=env,
            stdin=sys.stdin,
            stdout=sys.stdout,
            stderr=sys.stderr,
        )
        utils.loquacious(f"  Exited with code {completed.returncode}", env)
        return completed.returncode
    except FileNotFoundError:
        raise VantageException(f"Command '{cmd}' not found")

## Instruction:
Fix missing cmd name in error message
## Code After:
import sys
import subprocess

from vantage import utils
from vantage.exceptions import VantageException


def shell_cmd(env, cmd, *args):
    utils.loquacious(f"Running system defined '{cmd}' inside env", env)
    utils.loquacious(f"  With args: {args}", env)

    try:
        cmd_path = utils.find_executable(cmd)
        if cmd_path is None:
            raise FileNotFoundError()
        completed = subprocess.run(
            [cmd_path, *args],
            env=env,
            stdin=sys.stdin,
            stdout=sys.stdout,
            stderr=sys.stderr,
        )
        utils.loquacious(f"  Exited with code {completed.returncode}", env)
        return completed.returncode
    except FileNotFoundError:
        raise VantageException(f"Command '{cmd}' not found")
