From fae4b615347dd4279205b700d52da4c8759667f1 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sun, 13 Dec 2020 04:44:49 -0500 Subject: [PATCH] resolve cwd before creating directory --- src/core/process.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/process.cpp b/src/core/process.cpp index 8437a62..a7305bb 100644 --- a/src/core/process.cpp +++ b/src/core/process.cpp @@ -408,7 +408,11 @@ void process::create( cx_->trace(context::cmd, "creating process"); if (!cwd.empty()) - op::create_directories(*cx_, cwd); + { + // the path might be relative, especially when it comes from the command + // line, in which case it would fail the safety check + op::create_directories(*cx_, fs::absolute(cwd)); + } // cwd const wchar_t* cwd_p = (cwd.empty() ? nullptr : cwd.c_str());