Skip to content

buildtask: fix hang on large output #314

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 3 additions & 5 deletions src/projects/buildtask.vala
Original file line number Diff line number Diff line change
@@ -274,6 +274,8 @@ class Vls.BuildTask : BuildTarget {
}

Subprocess process = launcher.spawnv (arguments);
Bytes stdout;
process.communicate (null, cancellable, out stdout, null);
process.wait (cancellable);
if (cancellable.is_cancelled ()) {
process.force_exit ();
@@ -297,11 +299,7 @@ class Vls.BuildTask : BuildTarget {
if (output.size == 1 && !output[0].query_exists (cancellable)) {
// write contents of stdout to the output file if it was not created
var output_file = output[0];
var process_output_istream = process.get_stdout_pipe ();
if (process_output_istream != null) {
var outfile_ostream = output_file.replace (null, false, FileCreateFlags.NONE, cancellable);
outfile_ostream.splice (process_output_istream, OutputStreamSpliceFlags.NONE, cancellable);
}
output_file.replace_contents (stdout.get_data (), null, false, FileCreateFlags.NONE, null, cancellable);
}
// update the file metadata cache
foreach (var file in output)