From 9c12ad0187746d18589c655475b50571fc28fef4 Mon Sep 17 00:00:00 2001 From: Simon Hafner Date: Sat, 24 Jan 2015 18:01:39 -0600 Subject: [PATCH 1/3] typo fix --- tests/assert/tfailedassert.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/assert/tfailedassert.nim b/tests/assert/tfailedassert.nim index 4994e13c80..d03d3136bd 100644 --- a/tests/assert/tfailedassert.nim +++ b/tests/assert/tfailedassert.nim @@ -1,6 +1,6 @@ discard """ output: ''' -WARNING: false first asseertion from bar +WARNING: false first assertion from bar ERROR: false second assertion from bar -1 tfailedassert.nim:27 false assertion from foo @@ -31,7 +31,7 @@ proc bar: int = # in this proc onFailedAssert(msg): echo "WARNING: " & msg - assert(false, "first asseertion from bar") + assert(false, "first assertion from bar") onFailedAssert(msg): echo "ERROR: " & msg From 2beaa7a2da40e336b9606949ba65e0631c775767 Mon Sep 17 00:00:00 2001 From: Simon Hafner Date: Sat, 24 Jan 2015 18:02:00 -0600 Subject: [PATCH 2/3] find the nodejs binary upstream calls it node, debian calls it nodejs. We gotta look for both of them. --- compiler/nim.nim | 5 +++-- lib/core/nodejs.nim | 6 ++++++ tests/testament/tester.nim | 7 ++++--- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 lib/core/nodejs.nim diff --git a/compiler/nim.nim b/compiler/nim.nim index a87e0a1acd..553c4635f5 100644 --- a/compiler/nim.nim +++ b/compiler/nim.nim @@ -15,7 +15,8 @@ when defined(gcc) and defined(windows): import commands, lexer, condsyms, options, msgs, nversion, nimconf, ropes, - extccomp, strutils, os, osproc, platform, main, parseopt, service + extccomp, strutils, os, osproc, platform, main, parseopt, service, + nodejs when hasTinyCBackend: import tccgen @@ -67,7 +68,7 @@ proc handleCmdLine() = else: ex = quoteShell( completeCFilePath(changeFileExt(gProjectFull, "js").prependCurDir)) - execExternalProgram("node " & ex & ' ' & commands.arguments) + execExternalProgram(findNodeJs & " " & ex & ' ' & commands.arguments) else: var binPath: string if options.outFile.len > 0: diff --git a/lib/core/nodejs.nim b/lib/core/nodejs.nim new file mode 100644 index 0000000000..e2b79df19a --- /dev/null +++ b/lib/core/nodejs.nim @@ -0,0 +1,6 @@ +import os + +proc findNodeJs*(): string = + result = findExe("nodejs") + if result == "": + result = findExe("node") diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim index ba3abd1bd8..9a53f960ad 100644 --- a/tests/testament/tester.nim +++ b/tests/testament/tester.nim @@ -12,7 +12,7 @@ import parseutils, strutils, pegs, os, osproc, streams, parsecfg, json, marshal, backend, parseopt, specs, htmlgen, browsers, terminal, - algorithm + algorithm, nodejs const resultsFile = "testresults.html" @@ -187,12 +187,13 @@ proc testSpec(r: var TResults, test: TTest) = else: exeFile = changeFileExt(tname, ExeExt) if existsFile(exeFile): - if test.target == targetJS and findExe("nodejs") == "": + let nodejs = findNodeJs() + if test.target == targetJS and nodejs == "": r.addResult(test, expected.outp, "nodejs binary not in PATH", reExeNotFound) return var (buf, exitCode) = execCmdEx( - (if test.target == targetJS: "nodejs " else: "") & exeFile) + (if test.target == targetJS: nodejs & " " else: "") & exeFile) if exitCode != expected.exitCode: r.addResult(test, "exitcode: " & $expected.exitCode, "exitcode: " & $exitCode, reExitCodesDiffer) From 842c7f67ca06266d99577a31718ae1084cde033d Mon Sep 17 00:00:00 2001 From: Simon Hafner Date: Tue, 27 Jan 2015 13:04:27 -0600 Subject: [PATCH 3/3] added suggested fixes --- compiler/nim.nim | 2 +- lib/{core => pure}/nodejs.nim | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename lib/{core => pure}/nodejs.nim (100%) diff --git a/compiler/nim.nim b/compiler/nim.nim index 553c4635f5..c420f6f303 100644 --- a/compiler/nim.nim +++ b/compiler/nim.nim @@ -68,7 +68,7 @@ proc handleCmdLine() = else: ex = quoteShell( completeCFilePath(changeFileExt(gProjectFull, "js").prependCurDir)) - execExternalProgram(findNodeJs & " " & ex & ' ' & commands.arguments) + execExternalProgram(findNodeJs() & " " & ex & ' ' & commands.arguments) else: var binPath: string if options.outFile.len > 0: diff --git a/lib/core/nodejs.nim b/lib/pure/nodejs.nim similarity index 100% rename from lib/core/nodejs.nim rename to lib/pure/nodejs.nim