| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cd7c29e commit cd38401
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ int wmain(int argc, wchar_t *wargv[]) { | |||
| 11 | 11 | } | |
| 12 | 12 | ||
| 13 | 13 | // Convert argv to to UTF8 | |
| 14 | - char** argv = new char*[argc]; | ||
| 14 | + char** argv = new char*[argc + 1]; | ||
| 15 | 15 | for (int i = 0; i < argc; i++) { | |
| 16 | 16 | // Compute the size of the required buffer | |
| 17 | 17 | DWORD size = WideCharToMultiByte(CP_UTF8, | |
@@ -43,6 +43,7 @@ int wmain(int argc, wchar_t *wargv[]) { | |||
| 43 | 43 | exit(1); | |
| 44 | 44 | } | |
| 45 | 45 | } | |
| 46 | + argv[argc] = nullptr; | ||
| 46 | 47 | // Now that conversion is done, we can finally start. | |
| 47 | 48 | return node::Start(argc, argv); | |
| 48 | 49 | } | |
| 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 | |
@@ -66,6 +66,12 @@ child.exec(nodejs + ' --eval "require(\'./test/parallel/test-cli-eval.js\')"', | |||
| 66 | 66 | assert.equal(status.code, 42); | |
| 67 | 67 | }); | |
| 68 | 68 | ||
| 69 | + // Missing argument should not crash | ||
| 70 | + child.exec(nodejs + ' -e', common.mustCall(function(status, stdout, stderr) { | ||
| 71 | + assert.notStrictEqual(status, null); | ||
| 72 | + assert.strictEqual(status.code, 9); | ||
| 73 | + })); | ||
| 74 | + | ||
| 69 | 75 | // empty program should do nothing | |
| 70 | 76 | child.exec(nodejs + ' -e ""', function(status, stdout, stderr) { | |
| 71 | 77 | assert.equal(stdout, ''); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments