verifyJupyterCommand :: FilePath -> IO ()
verifyJupyterCommand jupyterPath = do
  versionInfo <- runJupyterCommand jupyterPath ["--version"]
  case parseVersion versionInfo of
    Nothing -> installFailed $ "Could not parse output of 'jupyter --version': " ++ versionInfo
    Just jupyterVersion ->
      unless (jupyterVersionSupported jupyterVersion) $
        installFailed $
          "Invalid Jupyter version: Jupyter version 3.0 or higher required, found "
          ++ showVersion jupyterVersion

-- | Run a @jupyter@ subcommand with no standard input.
--
-- Throws a 'JupyterKernelspecException' if the command cannot be run or returns a non-zero exit code.
verifyJupyterCommand :: FilePath -> IO ()
verifyJupyterCommand jupyterPath = do
  versionInfo <- runJupyterCommand jupyterPath ["--version"]
  case parseVersion versionInfo of
    Nothing -> installFailed $ "Could not parse output of 'jupyter --version': " ++ versionInfo
    Just jupyterVersion ->
      unless (jupyterVersionSupported jupyterVersion) $
        installFailed $
          "Invalid Jupyter version: Jupyter version 3.0 or higher required, found "
          ++ showVersion jupyterVersion

-- | Run a @jupyter@ subcommand with no standard input.
--
-- Throws a 'JupyterKernelspecException' if the command cannot be run or returns a non-zero exit code.
verifyJupyterCommand jupyterPath = do
  versionInfo <- runJupyterCommand jupyterPath ["--version"]
  case parseVersion versionInfo of
    Nothing -> installFailed $ "Could not parse output of 'jupyter --version': " ++ versionInfo
    Just jupyterVersion ->
      unless (jupyterVersionSupported jupyterVersion) $
        installFailed $
          "Invalid Jupyter version: Jupyter version 3.0 or higher required, found "
          ++ showVersion jupyterVersion

-- | Run a @jupyter@ subcommand with no standard input.
--
-- Throws a 'JupyterKernelspecException' if the command cannot be run or returns a non-zero exit code.