From 9000dc37f247bf3498b2938fea02f8fbdd58ff52 Mon Sep 17 00:00:00 2001 From: Kaustav Das Modak Date: Fri, 19 Feb 2016 02:21:27 +0530 Subject: [PATCH] Support launching debugger in Windows. Ref #18 Breakpoints still don't appear to work in Windows. Need testing. Signed-off-by: Kaustav Das Modak --- debug.bat | 2 ++ index.js | 3 ++- scripts/install.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 debug.bat diff --git a/debug.bat b/debug.bat new file mode 100644 index 00000000..fc1dc8be --- /dev/null +++ b/debug.bat @@ -0,0 +1,2 @@ +@echo off +node-debug %1 %2 diff --git a/index.js b/index.js index 4609331f..dd80210d 100755 --- a/index.js +++ b/index.js @@ -34,7 +34,8 @@ if(process.argv[2] === "--init") { else if(process.argv[2] === "--start") { if (process.env.DEBUG === "true") { - var debug_process = child_process.spawn("node-debug", ["./src/gauge.js", "--run"], + var node_debug = process.platform === "win32" ? "debug.bat" : "node-debug"; + var debug_process = child_process.spawn(node_debug, ["./src/gauge.js", "--run"], { env: process.env, stdio: "inherit" }); debug_process.on("error", function (err) { console.log(err.toString()); diff --git a/scripts/install.js b/scripts/install.js index a338bf1b..394e4984 100644 --- a/scripts/install.js +++ b/scripts/install.js @@ -33,7 +33,7 @@ var recreateDir = function (dirPath) { var prepareFiles = function () { var buildDir = localPath("build"), - copyList = ["gauge-proto", "src", "skel", "index.js", "index.bat", "js.json", "package.json", ".node-inspectorrc", "README.md"]; + copyList = ["gauge-proto", "src", "skel", "index.js", "index.bat", "debug.bat", "js.json", "package.json", ".node-inspectorrc", "README.md"]; recreateDir(buildDir);