[process] How to exec multiple shell commands
Hi! I have successfully used boost.process but now stuck with a problem. I need to execute 2 commands in one shell invocation. Both windows and linux allow do that, but I can't figure out how to do it with help of boost.process. Is there interface to do that? PS. I am using old boost.process. I have download process-is-0.4.zip from the vault and didn't find solution for my problem.
Konstantin Litvinenko wrote:
Hi! I have successfully used boost.process but now stuck with a problem. I need to execute 2 commands in one shell invocation. Both windows and linux allow do that, but I can't figure out how to do it with help of boost.process. Is there interface to do that?
PS. I am using old boost.process. I have download process-is-0.4.zip from the vault and didn't find solution for my problem.
Try this (untested): launch_shell("echo first & echo second", context()); You can also use && and ||
Ilya Sokolov пишет:
Konstantin Litvinenko wrote:
Hi! I have successfully used boost.process but now stuck with a problem. I need to execute 2 commands in one shell invocation. Both windows and linux allow do that, but I can't figure out how to do it with help of boost.process. Is there interface to do that?
PS. I am using old boost.process. I have download process-is-0.4.zip from the vault and didn't find solution for my problem.
Try this (untested): launch_shell("echo first & echo second", context()); You can also use && and ||
Thenx, Ilya, but this is not a solution because it is not posible to invoke: launch_shell("\"\"C:\\Program Files\\Microsoft Visual Studio 8\\VC\\bin\\vcvars32.bat\" && cl.exe /c .\main.cpp -Fo.\bin\main.obj\"", context()); In this case argument escaping rules will destroy original intent. I tried this commands in command line: cmd /C C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat &&cl.exe /c .\main.cpp -Fo.\bin\main.obj - errors cmd /C "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat" &&cl.exe /c .\main.cpp -Fo.\bin\main.obj - errors cmd /C ""C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat" &&cl.exe /c .\main.cpp -Fo.\bin\main.obj" - WORKS!!! How to get last one works with boost.process?
Konstantin Litvinenko пишет:
Ilya Sokolov пишет:
Konstantin Litvinenko wrote:
Hi! I have successfully used boost.process but now stuck with a problem. I need to execute 2 commands in one shell invocation. Both windows and linux allow do that, but I can't figure out how to do it with help of boost.process. Is there interface to do that?
PS. I am using old boost.process. I have download process-is-0.4.zip from the vault and didn't find solution for my problem.
Try this (untested): launch_shell("echo first & echo second", context()); You can also use && and ||
Thenx, Ilya, but this is not a solution because it is not posible to invoke:
launch_shell("\"\"C:\\Program Files\\Microsoft Visual Studio 8\\VC\\bin\\vcvars32.bat\" && cl.exe /c .\main.cpp -Fo.\bin\main.obj\"", context());
Try to remove one pair or quotes (untested again): launch_shell("\"C:\\Program Files\\Microsoft Visual Studio 8\\VC\\bin\\vcvars32.bat\" && cl.exe /c .\main.cpp -Fo.\bin\main.obj", context());
As a work around, could those 2 commands be wrapped in a batch file
and invoked? You can place the batch file in some convenient folder
that does not require complex back quoting.
-dhruva
On Wed, Dec 17, 2008 at 12:53 PM, Ilya Sokolov
Konstantin Litvinenko пишет:
Ilya Sokolov пишет:
Konstantin Litvinenko wrote:
Hi! I have successfully used boost.process but now stuck with a problem. I need to execute 2 commands in one shell invocation. Both windows and linux allow do that, but I can't figure out how to do it with help of boost.process. Is there interface to do that?
PS. I am using old boost.process. I have download process-is-0.4.zip from the vault and didn't find solution for my problem.
Try this (untested): launch_shell("echo first & echo second", context()); You can also use && and ||
Thenx, Ilya, but this is not a solution because it is not posible to invoke:
launch_shell("\"\"C:\\Program Files\\Microsoft Visual Studio 8\\VC\\bin\\vcvars32.bat\" && cl.exe /c .\main.cpp -Fo.\bin\main.obj\"", context());
Try to remove one pair or quotes (untested again): launch_shell("\"C:\\Program Files\\Microsoft Visual Studio 8\\VC\\bin\\vcvars32.bat\" && cl.exe /c .\main.cpp -Fo.\bin\main.obj", context());
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Contents reflect my personal views only!
participants (3)
-
dhruva
-
Ilya Sokolov
-
Konstantin Litvinenko