• Xavier Deguillard's avatar
    flush stdout before starting a command while interactive · 56693404
    Xavier Deguillard authored
    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
    56693404
runcmd.py 5.25 KB