Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit 6ec29f1

Browse files
fix: prevent crash
1 parent 08eee40 commit 6ec29f1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.bin/create-rust-webpack.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@ if (!isPresent("git --version")) {
3535
const args = process.argv.slice(2);
3636

3737
if (args.some(arg => arg.includes('-'))) {
38-
console.log(`Error: unknown option ${args[0]}`);
38+
console.log(`Error: unknown option ${args.filter(arg => arg.includes('-'))}`);
3939
process.exit(1);
4040
}
4141

4242
let folderName = '.';
43-
folderName = args[2];
4443

45-
if (!fs.existsSync(folderName)) {
46-
fs.mkdirSync(folderName);
44+
if (args.length >= 1) {
45+
folderName = args[0];
46+
47+
if (!fs.existsSync(folderName)) {
48+
fs.mkdirSync(folderName);
49+
}
4750
}
4851

4952
let gitFolder = path.join(folderName, "git-clone");

0 commit comments

Comments
 (0)