Comments (15)
from cpp-subprocess.
@santaclose Is your last PR related to this ?
Windows support has been a 100% community effort for this repo since I haven't had a windows machine for far too long. Appreciate if you could find the issue and open a PR.
On a side note, you could try raw string
std::string command = R"(explorer /select,"C:\\Windows\")";
from cpp-subprocess.
Your code snippet with he raw string didn't work either, I'll try to figure out what windows is doing with the arguments. My latest commit might not be the best solution.
I know that it works if szCmdLine
ends up containing this exact string: explorer /select,"C:\Windows"
, which also works from the command prompt.
from cpp-subprocess.
So, explorer /select,"C:\Windows"
works and explorer "/select,C:\Windows"
doesn't work, and I don't know why.
I made a little python script just to se what the process was receiving as arguments, and for both it should be the same 🤔.
Maybe these windows apps do something different.
from cpp-subprocess.
Seems to me the issue can be solved just by removing \"
from the list of characters that need quoting:
L" \t\n\v\""
--> L" \t\n\v"
But there must be a reason why @xoviat added it. And also, why was the force
argument always being set to true
?
from cpp-subprocess.
This may have been implemented incorrectly. See here for the correct implementation: https://learn.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way
from cpp-subprocess.
In fact it appears that the initial implementation was correct and your PR may have introduced a bug. It also appears that you are attempting to use the shell functionality on Windows which is not currently supported.
from cpp-subprocess.
thanks for the info, the only commit that was meant to be merged was the one with the call function overload, the solution for the quote issue is something temporary I pushed to my branch.
Then, from what you say, I understand I need shell functionality to run the explorer executable with the select argument?
why is this?
from cpp-subprocess.
With the code before your PR was merged, you should have been able to pass the executable and arguments as an initializer list, not as one command line string. If that was not the case I can look into the issue further.
from cpp-subprocess.
you mean like this?
subprocess::call("explorer", "/select,\"" + path.u8string() + "\"");
fails to compile with this error:
1>C:\Users\san\Desktop\scex\vendor\cpp-subprocess\subprocess.hpp(1377,7): error C2668: 'subprocess::detail::ArgumentDeducer::set_option': ambiguous call to overloaded function
this is at commit af23f338801ed19696da42b1f9b97f8e21dec5d6
from cpp-subprocess.
for reference, this python code seems to work fine:
import subprocess
subprocess.run(r'explorer /select,"C:\Windows"')
i think this library should work when given that same string
from cpp-subprocess.
see here for example: https://github.com/arun11299/cpp-subprocess/pull/91/files#diff-48ccdd15ee47b10be5729d81fb1ee3d6b0a37e113ffc53877a203300d8188b4dR43
i think this library should work when given that same string
in principle I agree. however, I think the more important functionality is to sanitize arguments when given a list. this is a large part of the reason I added this in the first place and hard to do right.
from cpp-subprocess.
I'm not sure exactly what python does but it may select behavior based on whether it's passed a list or not.
from cpp-subprocess.
yeah probably. Also, Is there a reason why you were forcing quotes? that was pretty much bypassing most of the function logic.
from cpp-subprocess.
@arun11299 I will work on this more after the CI pr is merged. I think it's important to have CI running first to prevent regressions.
from cpp-subprocess.
Related Issues (20)
- How to communicate with interactive shell script? HOT 1
- memory leak HOT 2
- execute_child shouldn't use any signal-unsafe functions
- string comparison issue on win32 HOT 1
- Thread safety? HOT 2
- missing inline in three MSVC specific functions HOT 1
- MinGW support HOT 1
- Windows support for environment variables HOT 2
- add option to redirect output to stdout
- [Question] Why delete operator= for the Streams class? HOT 4
- Blocking when using read_all with socket stream
- Busy looping when waiting for subprocess to finish HOT 1
- Conan support HOT 1
- wait() / communicate() can hang indefinitely with no recourse
- Popen blocking on Windows HOT 2
- Support CPM / cmake
- Compare with similar/related libraries HOT 2
- question: condition for `communicate_threaded` HOT 1
- Some windows errors HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpp-subprocess.