mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Remove lookupPathForProgram and implement initial runProgram test
Apparently, CreateProcessW already searches path, so manual path search isn't really necessary.
This commit is contained in:
parent
fcb92b4fa4
commit
8b81d083a7
2 changed files with 8 additions and 47 deletions
|
@ -3,22 +3,15 @@
|
|||
#include "processes.hh"
|
||||
|
||||
namespace nix {
|
||||
/*
|
||||
TEST(SpawnTest, spawnEcho)
|
||||
{
|
||||
auto output = runProgram(RunOptions{.program = "cmd", .lookupPath = true, .args = {"/C", "echo \"hello world\""}});
|
||||
std::cout << output.second << std::endl;
|
||||
}
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
Path lookupPathForProgram(const Path & program);
|
||||
TEST(SpawnTest, pathSearch)
|
||||
TEST(SpawnTest, spawnEcho)
|
||||
{
|
||||
ASSERT_NO_THROW(lookupPathForProgram("cmd"));
|
||||
ASSERT_NO_THROW(lookupPathForProgram("cmd.exe"));
|
||||
ASSERT_THROW(lookupPathForProgram("C:/System32/cmd.exe"), UsageError);
|
||||
auto output = runProgram(RunOptions{.program = "cmd.exe", .args = {"/C", "echo", "hello world"}});
|
||||
ASSERT_EQ(output.first, 0);
|
||||
ASSERT_EQ(output.second, "\"hello world\"\r\n");
|
||||
}
|
||||
|
||||
std::string windowsEscape(const std::string & str, bool cmd);
|
||||
|
||||
TEST(SpawnTest, windowsEscape)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue