Skip to content

Commit 30a2aaf

Browse files
myd7349anonrig
authored andcommitted
fix: resolve std::system_error in adaparse on Windows
1 parent a86b996 commit 30a2aaf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/cli/adaparse.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ int piped_file(Callable&& adaparse_print, const cxxopts::ParseResult result,
201201
int main(int argc, char** argv) {
202202
std::ios::sync_with_stdio(false);
203203

204+
#ifdef _WIN32
205+
const char* devnull = "nul";
206+
#else
207+
const char* devnull = "/dev/null";
208+
#endif
209+
204210
cxxopts::Options options("adaparse",
205211
"Command-line version of the Ada URL parser");
206212

@@ -211,7 +217,7 @@ int main(int argc, char** argv) {
211217
("g,get", "Get a specific part of the URL (e.g., 'origin', 'host', etc.)", cxxopts::value<std::string>())
212218
("b,benchmark", "Display chronometer for piped_file function", cxxopts::value<bool>()->default_value("false"))
213219
("p,path", "Takes in a path to a file and process all the URL within", cxxopts::value<std::string>())
214-
("o,output", "Takes in a path and outputs to a text file.", cxxopts::value<std::string>()->default_value("/dev/null"))
220+
("o,output", "Takes in a path and outputs to a text file.", cxxopts::value<std::string>()->default_value(devnull))
215221
("h,help", "Print usage");
216222
// clang-format on
217223

0 commit comments

Comments
 (0)