Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't wastefully execute everything via a shell #2674

Merged
merged 2 commits into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/dub/compilers/compiler.d
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ interface Compiler {

int status;
if (output_callback) {
auto result = executeShell(escapeShellCommand(args),
auto result = execute(args,
env, Config.none, size_t.max, cwd.toNativeString());
output_callback(result.status, result.output);
status = result.status;
} else {
auto compiler_pid = spawnShell(escapeShellCommand(args),
auto compiler_pid = spawnProcess(args,
env, Config.none, cwd.toNativeString());
status = compiler_pid.wait();
}
Expand Down Expand Up @@ -185,7 +185,7 @@ interface Compiler {

auto fil = generatePlatformProbeFile();

auto result = executeShell(escapeShellCommand(compiler_binary ~ args ~ fil.toNativeString()));
auto result = execute(compiler_binary ~ args ~ fil.toNativeString());
enforce!CompilerInvocationException(result.status == 0,
format("Failed to invoke the compiler %s to determine the build platform: %s",
compiler_binary, result.output));
Expand Down
2 changes: 1 addition & 1 deletion source/dub/internal/git.d
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private string determineVersionWithGitTool(NativePath path)
auto git_dir_param = "--git-dir=" ~ git_dir.toNativeString();

static string exec(scope string[] params...) {
auto ret = executeShell(escapeShellCommand(params));
auto ret = execute(params);
if (ret.status == 0) return ret.output.strip;
logDebug("'%s' failed with exit code %s: %s", params.join(" "), ret.status, ret.output.strip);
return null;
Expand Down
2 changes: 1 addition & 1 deletion test/issue895-local-configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fi
rm ../etc/dub/settings.json
echo "Empty file named ldc2." > ../bin/ldc2

if ! { ${DUB} describe --single issue103-single-file-package.d 2>&1 || true; } | grep -cF "Failed to invoke the compiler $(dirname $CURR_DIR)/bin/ldc2 to determine the build platform"; then
if ! { ${DUB} describe --single issue103-single-file-package.d 2>&1 || true; } | grep -cF "Failed to execute '$(dirname $CURR_DIR)/bin/ldc2'"; then
Copy link
Member

@WebFreak001 WebFreak001 Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uh do you know why this failed? / needed to be changed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes? I explained it in the commit message.

rm ../bin/ldc2
die $LINENO 'DUB did not find ldc2 adjacent to it.'
fi
Expand Down
Loading