Fix edit command. (#1221)
This commit is contained in:
Родитель
0d3da0808d
Коммит
9601b79102
|
@ -530,6 +530,12 @@ set_property(TARGET closes-stdout PROPERTY PDB_NAME "closes-stdout${VCPKG_PDB_SU
|
|||
set(READS_STDIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/reads-stdin.c")
|
||||
add_executable(reads-stdin ${READS_STDIN_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/src/vcpkg.manifest")
|
||||
set_property(TARGET reads-stdin PROPERTY PDB_NAME "reads-stdin${VCPKG_PDB_SUFFIX}")
|
||||
|
||||
# === Target: test-editor ===
|
||||
|
||||
set(TEST_EDITOR_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/test-editor.c")
|
||||
add_executable(test-editor ${TEST_EDITOR_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/src/vcpkg.manifest")
|
||||
set_property(TARGET test-editor PROPERTY PDB_NAME "test-editor${VCPKG_PDB_SUFFIX}")
|
||||
endif()
|
||||
|
||||
# === Target: format ===
|
||||
|
@ -554,6 +560,7 @@ if(CLANG_FORMAT)
|
|||
COMMAND "${CLANG_FORMAT}" -i -verbose ${CLOSES_STDIN_SOURCES}
|
||||
COMMAND "${CLANG_FORMAT}" -i -verbose ${CLOSES_STDOUT_SOURCES}
|
||||
COMMAND "${CLANG_FORMAT}" -i -verbose ${READS_STDIN_SOURCES}
|
||||
COMMAND "${CLANG_FORMAT}" -i -verbose ${TEST_EDITOR_SOURCES}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
. $PSScriptRoot/../end-to-end-tests-prelude.ps1
|
||||
|
||||
$expected = "$env:VCPKG_ROOT/ports/zlib`n$env:VCPKG_ROOT/ports/zlib/portfile.cmake`n-n"
|
||||
$expected = $expected.Replace('\', '/')
|
||||
|
||||
Refresh-TestRoot
|
||||
|
||||
$buildDir = (Get-Item $VcpkgExe).Directory
|
||||
$tempFilePath = "$TestingRoot/result.txt"
|
||||
|
||||
$env:VCPKG_TEST_OUTPUT = $tempFilePath
|
||||
$editor = "$buildDir/test-editor"
|
||||
if ($IsWindows) {
|
||||
$editor += '.exe'
|
||||
}
|
||||
|
||||
Write-Host "Using editor $editor"
|
||||
$env:EDITOR = $editor
|
||||
try {
|
||||
Run-Vcpkg edit zlib
|
||||
Throw-IfFailed
|
||||
|
||||
$result = Get-Content -LiteralPath $tempFilePath -Raw
|
||||
} finally {
|
||||
Remove-Item env:VCPKG_TEST_OUTPUT
|
||||
Remove-Item env:EDITOR
|
||||
}
|
||||
|
||||
$result = $result.Trim().Replace('\', '/')
|
||||
|
||||
if ($result -ne $expected) {
|
||||
throw 'Did not edit the expected directory.'
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
const char* path;
|
||||
FILE* f;
|
||||
|
||||
path = getenv("VCPKG_TEST_OUTPUT");
|
||||
if (!path)
|
||||
{
|
||||
puts("bad env var");
|
||||
return 1;
|
||||
}
|
||||
|
||||
f = fopen(path, "wb");
|
||||
if (!f)
|
||||
{
|
||||
puts("bad open");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int idx = 1; idx < argc; ++idx)
|
||||
{
|
||||
if (fputs(argv[idx], f) < 0)
|
||||
{
|
||||
puts("bad write");
|
||||
}
|
||||
|
||||
if (fputs("\n", f) < 0)
|
||||
{
|
||||
puts("bad write newline");
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
|
@ -731,6 +731,7 @@ namespace
|
|||
StringView cmd_line,
|
||||
const WorkingDirectory& wd,
|
||||
const Environment& env,
|
||||
BOOL bInheritHandles,
|
||||
DWORD dwCreationFlags,
|
||||
STARTUPINFOEXW& startup_info) noexcept
|
||||
{
|
||||
|
@ -764,7 +765,7 @@ namespace
|
|||
Strings::to_utf16(cmd_line).data(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
TRUE,
|
||||
bInheritHandles,
|
||||
IDLE_PRIORITY_CLASS | CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT |
|
||||
dwCreationFlags,
|
||||
call_environment,
|
||||
|
@ -1118,7 +1119,7 @@ namespace
|
|||
startup_info_ex.lpAttributeList = proc_attribute_list.get();
|
||||
|
||||
auto process_create =
|
||||
windows_create_process(debug_id, ret.proc_info, cmd_line, wd, env, dwCreationFlags, startup_info_ex);
|
||||
windows_create_process(debug_id, ret.proc_info, cmd_line, wd, env, TRUE, dwCreationFlags, startup_info_ex);
|
||||
|
||||
if (!process_create)
|
||||
{
|
||||
|
@ -1320,28 +1321,12 @@ namespace vcpkg
|
|||
startup_info_ex.StartupInfo.cb = sizeof(STARTUPINFOEXW);
|
||||
startup_info_ex.StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
|
||||
startup_info_ex.StartupInfo.wShowWindow = SW_HIDE;
|
||||
|
||||
ProcAttributeList proc_attribute_list;
|
||||
auto proc_attribute_list_create = proc_attribute_list.create(1);
|
||||
if (!proc_attribute_list_create)
|
||||
{
|
||||
debug_print_cmd_execute_background_failure(debug_id, proc_attribute_list_create.error());
|
||||
return;
|
||||
}
|
||||
|
||||
auto maybe_error = proc_attribute_list.update_attribute(PROC_THREAD_ATTRIBUTE_HANDLE_LIST, nullptr, 0);
|
||||
if (!maybe_error)
|
||||
{
|
||||
debug_print_cmd_execute_background_failure(debug_id, maybe_error.error());
|
||||
return;
|
||||
}
|
||||
|
||||
startup_info_ex.lpAttributeList = proc_attribute_list.get();
|
||||
auto process_create = windows_create_process(debug_id,
|
||||
process_info,
|
||||
cmd_line.command_line(),
|
||||
default_working_directory,
|
||||
default_environment,
|
||||
FALSE,
|
||||
CREATE_NEW_CONSOLE | CREATE_NO_WINDOW | CREATE_BREAKAWAY_FROM_JOB,
|
||||
startup_info_ex);
|
||||
if (!process_create)
|
||||
|
@ -1408,7 +1393,7 @@ namespace vcpkg
|
|||
SpawnProcessGuard spawn_process_guard;
|
||||
ProcessInfo process_info;
|
||||
auto process_create =
|
||||
windows_create_process(debug_id, process_info, cmd_line.command_line(), wd, env, 0, startup_info_ex);
|
||||
windows_create_process(debug_id, process_info, cmd_line.command_line(), wd, env, TRUE, 0, startup_info_ex);
|
||||
if (!process_create)
|
||||
{
|
||||
return std::move(process_create).error();
|
||||
|
|
Загрузка…
Ссылка в новой задаче