Git Product home page Git Product logo

Comments (6)

Tieske avatar Tieske commented on May 16, 2024

On windows I saw similar behaviour. I think it is either because of the shell scripts (batch file on windows) or because the path searched is being searched from the lua VM executable location.

That's why I added the --lpath option, which defaults to something like "./src/?.lua;./src/?/?.lua;./src/?/init.lua" iirc (check the /bin/bootstrap file to be sure)

quick fix: move foo.lua to src/foo.lua then the default --lpath should work for you.

from busted.

kikito avatar kikito commented on May 16, 2024

Thanks for your help. The version I have in my computer (installed just today with luarocks install busted) is 1.3-1. It doesn't seem to come with --lpath support yet.

This got me thinking, though. Isn't using --lpath a workaround, more than a real fix? I'm no shell script expert, but surely it's possible to tell them to execute from a specific dir.

from busted.

Tieske avatar Tieske commented on May 16, 2024

yes and no. For your case it probably is a workaround, for my case, /src/ subdir it is not. The most common case is a subdir I believe, /src/ is just one common possibility. I have several repo's with /source/ in which case I need the --lpath option to replace the default or my modules won't load.

from busted.

kikito avatar kikito commented on May 16, 2024

Ok I think I'm onto something.

The first line in the busted executable is this one:

DIR="$( cd "$( dirname "$0" )" && pwd )/"

The cd "$( dirname "$0" )" part of that line effectively changes the execution environment to the folder where the executable is, i.e. /usr/local/bin/ .

This makes the following lines not fail:

$COMMAND busted_bootstrap $*;
...
$COMMAND busted_bootstrap --cwd="$CWD" $*;

But it has other consequences. The current path is effectively "broken".

CWD=${PWD}/

That also will point to /usr/local/bin.

I think invoking that cd at the beginning complicates things unnecessarily.

I propose obtaining the DIR variable without invoking cd, and appending it to it to "/busted_bootstrap" when needed:

DIR="$( dirname "$0" )"
BOOTSTRAP_PATH="$DIR/busted_bootstrap"
...
# The --cwd option and $CWD variables are not needed, so the previous two lines become this:
$COMMAND $BOOTSTRAP_PATH $*;

I'm submitting a pull request with these changes.

I see that bootstrap.bat has another "cd" inside it, but I'm not experienced enough with .bat files to be able to change that one.

from busted.

kikito avatar kikito commented on May 16, 2024

Unless the windows version needs changing, this issue is probably solved with the commit above this comment.

from busted.

DorianGray avatar DorianGray commented on May 16, 2024

I fixed the windows version. Closing.

from busted.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.