premake / premake/premake-core

help and version not shown if a premake5.lua with errors is present

Open
#1,508 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Description

What seems to be the problem?
--help or --version doesn't show if there's a 'premake5.lua' with errors in the same folder

 ~/project-folder$ premake5 --help
 Error: module 'premake/my_module' not found:
    no field package.preload['premake/my_module']
    no file '/usr/local/share/lua/5.3/premake/my_module.lua'
    no file '/usr/local/share/lua/5.3/premake/my_module/init.lua'
    no file '/usr/local/lib/lua/5.3/premake/my_module.lua'
    no file '/usr/local/lib/lua/5.3/premake/my_module/init.lua'
    no file './premake/my_module.lua'
    no file './premake/my_module/init.lua'
    no file '/usr/local/lib/lua/5.3/premake/my_module.so'
    no file '/usr/local/lib/lua/5.3/loadall.so'
    no file './premake/my_module.so'
    no file '/usr/bin/premake/my_module.so'

What did you expect to happen?
Help or version should be independent of the premake5.lua file

What have you tried so far?
When I go back to the parent folder (without a premake5.lua) the version works as expected

~/$ premake5 --version
premake5 (Premake Build Script Generator) 5.0.0-dev

How can we reproduce this?
Create or modify a premake5.lua file with a reference to a missing file module and try premake5 --version

What version of Premake are you using?
5.0.0-dev from master
(as today it is https://github.com/premake/premake-core/commit/670935a23f28e28f895d072c4811437dac6fa269)

Thank you!!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in a folder containing premake5.lua with a missing module reference, then compare premake5 --help and premake5 --version there with the same commands from the parent folder. Trace the premake5 command-line entry point and confirm that help and version work despite the script error; done means both commands show their expected output in that folder.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.