executorch icon indicating copy to clipboard operation
executorch copied to clipboard

Properly kill the buck2 daemon

Open dbort opened this issue 4 months ago • 2 comments

Fix the buck2 kill command. Because of scoping issues, in some cases we only ran " kill" because the local value of $BUCK2 was empty.

This should help avoid failures like

  Error validating working directory
  Caused by:
      0: Failed to stat `/home/ubuntu/cmodi/executorch/buck-out/v2`
      1: ENOENT: No such file or directory

which are typically fixed by running buck2 kill.

Add "COMMAND_ECHO" to the kill command to show what we're running.

Also, make the function consistently use executorch_root as the working directory. We should always run buck2 from the ET repo.

Test Plan:

rm -rf buck-out
(rm -rf cmake-out \
    && mkdir cmake-out \
    && cd cmake-out \
    && cmake ..)

Output showed that the local variable works:

-- Resolved buck2 as /Users/***/local/executorch/cmake-out/buck2-bin/buck2-99773fe6f7963a72ae5f7b737c02836e.
-- Killing buck2 daemon
'/Users/***/local/executorch/cmake-out/buck2-bin/buck2-99773fe6f7963a72ae5f7b737c02836e kill'

And that the parent variable still works:

-- ******** Summary ********
...
--   BUCK2                         : /Users/***/local/executorch/cmake-out/buck2-bin/buck2-99773fe6f7963a72ae5f7b737c02836e

dbort avatar Oct 04 '24 01:10 dbort