Skip to content

Commit afc6c24

Browse files
authored
Merge pull request #14928 from Zaczero/zaczero/nixmain
Remove regex from isNixCommand
2 parents a3043d9 + 7c3b4f7 commit afc6c24

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/nix/main.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "cli-config-private.hh"
2828

2929
#include <sys/types.h>
30-
#include <regex>
3130
#include <nlohmann/json.hpp>
3231

3332
#ifndef _WIN32
@@ -501,7 +500,7 @@ void mainWrapped(int argc, char ** argv)
501500
});
502501

503502
try {
504-
auto isNixCommand = std::regex_search(programName, std::regex("nix$"));
503+
auto isNixCommand = programName.ends_with("nix");
505504
auto allowShebang = isNixCommand && argc > 1;
506505
args.parseCmdline(argvToStrings(argc, argv), allowShebang);
507506
} catch (UsageError &) {

0 commit comments

Comments
 (0)