Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix temp file bug #81

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BEGIN {
split("",GoalsByName) # name -> private
split("",Code) # name -> body
split("",DefineOverrides) # k -> ""
DefinesFile=""
DefinesCode=""
split("",Dependencies) # name,i -> dep goal
split("",DependenciesLineNo) # name,i -> line no.
split("",DependenciesCnt) # name -> dep cnd
Expand Down Expand Up @@ -142,14 +142,11 @@ function handleDefine() {
handleDefineLine($0)
}
function handleDefineLine(line, kv,l) {
if (!DefinesFile)
DefinesFile = executeGetLine("mktemp " Tmp "/makesure.XXXXXXXXXX")

splitKV(line, kv)

if (!(kv[0] in DefineOverrides)) {
handleCodeLine(l = line "; export " kv[0])
handleCodeLine("echo " quoteArg(l) " >> " DefinesFile)
DefinesCode = DefinesCode "\n" line "; export " kv[0]
}
}

Expand Down Expand Up @@ -402,8 +399,8 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) {
}

addLine(definesLine, MyDirScript)
if (DefinesFile)
addLine(definesLine, ". " DefinesFile)
if (DefinesCode)
addLine(definesLine, DefinesCode)

for (i = 0; i in GoalNames; i++) {
goalName = GoalNames[i]
Expand Down Expand Up @@ -502,8 +499,6 @@ function currentLibName() { return arrLast(LibNames) }

function realExit(code) {
Died = 1
if (DefinesFile)
rm(DefinesFile)
exit code
}
function addError(err, n) { if (!n) n=NR; Error=addL(Error, err ":\n" ARGV[1] ":" n ": " Lines[n]) }
Expand Down
7 changes: 2 additions & 5 deletions tests/15_lib.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@

# TODO found one other bug, but let's fix it separately
#@define HELLO="Hello"
@define HELLO="Hello"

@lib
f1 () {
# TODO found one other bug, but let's fix it separately
#echo "$HELLO $1"
echo "Hello $1"
echo "$HELLO $1"
}

@goal g1
Expand Down
2 changes: 0 additions & 2 deletions tests/4_trace.tush
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/4_trace.sh -x
| A=aaa
@ + A=aaa
@ + export A
@ + echo ' A=aaa; export A'
@ + echo A=aaa

$ cd "$MYDIR"; ./$MAKESURE -f tests/4_trace.sh --tracing
| goal 'default' ...
| A=aaa
@ + A=aaa
@ + export A
@ + echo ' A=aaa; export A'
@ + echo A=aaa