Skip to content

Commit f6077f3

Browse files
committed
Fix a bug in ProcessRunner:
Pass empty stdin to the child processes instead of allowing them to inherit stdin from the parent process.
1 parent 4ddc4c8 commit f6077f3

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

src/DOpusScriptingExtensions/DOpusScriptingExtensions.vcxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@
200200
</Target>
201201
<!-- Download ExifTool binaries -->
202202
<Target Name="DownloadExifTool" AfterTargets="Build" Condition="!Exists('$(BuildFolder)exiftool.zip')">
203-
<DownloadFile SourceUrl="https://exiftool.org/exiftool-13.30_64.zip" DestinationFolder="$(BuildFolder)" DestinationFileName="exiftool.zip" />
203+
<DownloadFile SourceUrl="https://netix.dl.sourceforge.net/project/exiftool/exiftool-13.33_64.zip?viasf=1" DestinationFolder="$(BuildFolder)" DestinationFileName="exiftool.zip" />
204204
<Unzip SourceFiles="$(BuildFolder)exiftool.zip" DestinationFolder="$(BuildFolder)" />
205205
</Target>
206206
<Target Name="CopyExifToolToOutputFolder" AfterTargets="DownloadExifTool" Condition="!Exists('$(OutputPath)exiftool')">
207-
<Exec Command="robocopy &quot;$(BuildFolder)exiftool-13.30_64&quot; &quot;$(OutputPath)exiftool&quot; /e &gt; nul" ContinueOnError="True" />
207+
<Exec Command="robocopy &quot;$(BuildFolder)exiftool-13.33_64&quot; &quot;$(OutputPath)exiftool&quot; /e &gt; nul" ContinueOnError="True" />
208208
<Exec Command="ren &quot;$(OutputPath)exiftool\exiftool(-k).exe&quot; &quot;exiftool.exe&quot;" />
209209
</Target>
210210
<!-- Download language files for MediaInfoLib -->
@@ -215,4 +215,4 @@
215215
<Target Name="CopyMediaInfoLanguagesToOutputFolder" AfterTargets="DownloadMediaInfo" Condition="!Exists('$(OutputPath)MediaInfoLanguages')">
216216
<Exec Command="robocopy &quot;$(BuildFolder)MediaInfo-25.04/Source/Resource/Plugin/Language&quot; &quot;$(OutputPath)MediaInfoLanguages&quot; /e &gt; nul" ContinueOnError="True" />
217217
</Target>
218-
</Project>
218+
</Project>

src/DOpusScriptingExtensions/ProcessRunner/ProcessRunner.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ class ATL_NO_VTABLE CProcessRunner :
2929
static std::tuple<std::wstring, std::wstring, int> RunProcess(const boost::filesystem::path& exePath,
3030
const std::vector<std::string>& args,
3131
const boost::filesystem::path& workingDirectory) {
32-
if (!boost::filesystem::exists(exePath))
33-
{
32+
if (!boost::filesystem::exists(exePath)) {
3433
THROW_WEXCEPTION(L"The executable not found '{}'", exePath);
3534
}
3635

37-
if (!boost::process::v2::environment::detail::is_exec_type(exePath.c_str()))
38-
{
36+
if (!boost::process::v2::environment::detail::is_exec_type(exePath.c_str())) {
3937
THROW_WEXCEPTION(L"The file '{}' is not executable", exePath);
4038
}
4139

@@ -44,7 +42,7 @@ class ATL_NO_VTABLE CProcessRunner :
4442
boost::asio::readable_pipe stdOutPipe(ctx), stdErrPipe(ctx);
4543
boost::process::v2::process proc(
4644
ctx, boost::filesystem::canonical(exePath), args,
47-
boost::process::v2::process_stdio{ {}, stdOutPipe, stdErrPipe },
45+
boost::process::v2::process_stdio{ nullptr, stdOutPipe, stdErrPipe },
4846
boost::process::v2::windows::show_window_hide,
4947
boost::process::process_start_dir(workingDirectory));
5048

@@ -56,8 +54,7 @@ class ATL_NO_VTABLE CProcessRunner :
5654
if (!ec) {
5755
readStdOut();
5856
}
59-
}
60-
);
57+
});
6158
};
6259

6360
std::function<void()> readStdErr;
@@ -68,8 +65,7 @@ class ATL_NO_VTABLE CProcessRunner :
6865
if (!ec) {
6966
readStdErr();
7067
}
71-
}
72-
);
68+
});
7369
};
7470

7571
readStdOut();
@@ -81,7 +77,7 @@ class ATL_NO_VTABLE CProcessRunner :
8177

8278
return { ToUtf16({ GetDataPointer(outBuffer), outBuffer.size() }),
8379
ToUtf16({ GetDataPointer(errBuffer), errBuffer.size() }),
84-
exitCode };
80+
exitCode };
8581
}
8682
};
8783

0 commit comments

Comments
 (0)