| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9cccaa3 commit 426aa0a
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | #ifdef _WIN32 | |
| 4 | 4 | int wmain(int argc, wchar_t *wargv[]) { | |
| 5 | 5 | // Convert argv to to UTF8 | |
| 6 | - char** argv = new char*[argc]; | ||
| 6 | + char** argv = new char*[argc + 1]; | ||
| 7 | 7 | for (int i = 0; i < argc; i++) { | |
| 8 | 8 | // Compute the size of the required buffer | |
| 9 | 9 | DWORD size = WideCharToMultiByte(CP_UTF8, | |
@@ -35,6 +35,7 @@ int wmain(int argc, wchar_t *wargv[]) { | |||
| 35 | 35 | exit(1); | |
| 36 | 36 | } | |
| 37 | 37 | } | |
| 38 | + argv[argc] = nullptr; | ||
| 38 | 39 | // Now that conversion is done, we can finally start. | |
| 39 | 40 | return node::Start(argc, argv); | |
| 40 | 41 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,11 +40,11 @@ child.exec(nodejs + ' --eval "console.error(42)"', | |||
| 40 | 40 | assert.equal(stderr, ''); | |
| 41 | 41 | }); | |
| 42 | 42 | ||
| 43 | - child.exec(cmd + "'[]'", | ||
| 43 | + child.exec(cmd + "'[]'", common.mustCall( | ||
| 44 | 44 | function(err, stdout, stderr) { | |
| 45 | 45 | assert.equal(stdout, '[]\n'); | |
| 46 | 46 | assert.equal(stderr, ''); | |
| 47 | - }); | ||
| 47 | + })); | ||
| 48 | 48 | }); | |
| 49 | 49 | ||
| 50 | 50 | // assert that module loading works | |
@@ -59,6 +59,12 @@ child.exec(nodejs + ' --eval "require(\'./test/parallel/test-cli-eval.js\')"', | |||
| 59 | 59 | assert.equal(status.code, 42); | |
| 60 | 60 | }); | |
| 61 | 61 | ||
| 62 | + // Missing argument should not crash | ||
| 63 | + child.exec(nodejs + ' -e', common.mustCall(function(status, stdout, stderr) { | ||
| 64 | + assert.notStrictEqual(status, null); | ||
| 65 | + assert.strictEqual(status.code, 9); | ||
| 66 | + })); | ||
| 67 | + | ||
| 62 | 68 | // empty program should do nothing | |
| 63 | 69 | child.exec(nodejs + ' -e ""', function(status, stdout, stderr) { | |
| 64 | 70 | assert.equal(stdout, ''); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments