Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
e917d4d1
Commit
e917d4d1
authored
Jun 24, 2018
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow .cmd/.bat files as compiler plugins on Windows.
Fixes #487 Fixes #695
parent
5b1d515f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
capnp.c++
c++/src/capnp/compiler/capnp.c++
+13
-10
No files found.
c++/src/capnp/compiler/capnp.c++
View file @
e917d4d1
...
...
@@ -540,13 +540,20 @@ public:
#endif
}
#if _WIN32
// MSVCRT's spawn*() don't correctly escape arguments, which is necessary on Windows
// since the underlying system call takes a single command line string rather than
// an arg list. We do the escaping ourselves by wrapping the name in quotes. We know
// that exeName itself can't contain quotes (since filenames aren't allowed to contain
// quotes on Windows), so we don't have to account for those.
KJ_ASSERT
(
exeName
.
findFirst
(
'\"'
)
==
nullptr
,
"Windows filenames can't contain quotes"
,
exeName
);
auto
escapedExeName
=
kj
::
str
(
"
\"
"
,
exeName
,
"
\"
"
);
#endif
if
(
shouldSearchPath
)
{
#if _WIN32
// MSVCRT's spawn*() don't correctly escape arguments, which is necessary on Windows
// since the underlying system call takes a single command line string rather than
// an arg list. Instead of trying to do the escaping ourselves, we just pass "plugin"
// for argv[0].
child
=
_spawnlp
(
_P_NOWAIT
,
exeName
.
cStr
(),
"plugin"
,
nullptr
);
child
=
_spawnlp
(
_P_NOWAIT
,
exeName
.
cStr
(),
escapedExeName
.
cStr
(),
nullptr
);
#else
execlp
(
exeName
.
cStr
(),
exeName
.
cStr
(),
nullptr
);
#endif
...
...
@@ -562,11 +569,7 @@ public:
}
#if _WIN32
// MSVCRT's spawn*() don't correctly escape arguments, which is necessary on Windows
// since the underlying system call takes a single command line string rather than
// an arg list. Instead of trying to do the escaping ourselves, we just pass "plugin"
// for argv[0].
child
=
_spawnl
(
_P_NOWAIT
,
exeName
.
cStr
(),
"plugin"
,
nullptr
);
child
=
_spawnl
(
_P_NOWAIT
,
exeName
.
cStr
(),
escapedExeName
.
cStr
(),
nullptr
);
#else
execl
(
exeName
.
cStr
(),
exeName
.
cStr
(),
nullptr
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment