Commit 56693404 authored by Xavier Deguillard's avatar Xavier Deguillard Committed by Facebook GitHub Bot

flush stdout before starting a command while interactive

Summary:
Now that the subprocess output is no longer piped, we can see a weird situation
where the command being run is displayed after the compilation step:
  + cd /data/users/xavierd/scratch/dataZusersZxavierdZfbsource/fbcode_builder_getdeps/build/eden && \
  [1/13] rust_job_pool
      Finished release [optimized] target(s) in 0.75s
  [12/13] Install the project...
  -- Install configuration: "RelWithDebInfo"
  -- Installing: /data/users/xavierd/scratch/dataZusersZxavierdZfbsource/fbcode_builder_getdeps/installed/eden/bin/edenfs
  -- Set runtime path of "/data/users/xavierd/scratch/dataZusersZxavierdZfbsource/fbcode_builder_getdeps/installed/eden/bin/edenfs" to ""
  -- Up-to-date: /data/users/xavierd/scratch/dataZusersZxavierdZfbsource/fbcode_builder_getdeps/installed/eden/bin/edenfsctl
  -- Up-to-date: /data/users/xavierd/scratch/dataZusersZxavierdZfbsource/fbcode_builder_getdeps/installed/eden/lib/libbackingstore_rs.a
  -- Up-to-date: /data/users/xavierd/scratch/dataZusersZxavierdZfbsource/fbcode_builder_getdeps/installed/eden/lib/libbackingstore.a
  -- Up-to-date: /data/users/xavierd/scratch/dataZusersZxavierdZfbsource/fbcode_builder_getdeps/installed/eden/include/eden/scm/lib/backingstore/c_api/HgNativeBackingStore.h
  -- Up-to-date: /data/users/xavierd/scratch/dataZusersZxavierdZfbsource/fbcode_builder_getdeps/installed/eden/include/eden/scm/lib/backingstore/c_api/RustBackingStore.h
  + /data/users/xavierd/scratch/dataZusersZxavierdZfbsource/fbcode_builder_getdeps/installed/cmake-Ncng4tsJb6gdOu40ggy14-YtgNQD43 (https://github.com/facebook/folly/commit/f47621ec247c8009d8a8aae8823f0de7c27a70fe)k5ev0n-FXq99I/bin/cmake \
  +      --build \
  +      /data/users/xavierd/scratch/dataZusersZxavierdZfbsource/fbcode_builder_getdeps/build/eden \
  +      --target \
  +      install \
  +      --config \
  +      Release \
  +      -j \
  +      24

This is a bit awkward. Flushing stdout's buffer allows for the ordering to be
correct.

Reviewed By: wez

Differential Revision: D23079405

fbshipit-source-id: e2bf25b098d6ab4a788a5ec07deb635a42cae18c
parent 698754f3
......@@ -98,6 +98,7 @@ def _run_cmd(cmd, env, cwd, allow_fail, log_fn):
isinteractive = os.isatty(sys.stdout.fileno())
if isinteractive:
stdout = None
sys.stdout.buffer.flush()
else:
stdout = subprocess.PIPE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment