Skip to content
  • Yuya Nishihara's avatar
    rust-chg: add config validation and process returned instructions · 9ce613d648de
    Yuya Nishihara authored
    This is the reimplementation of runinstructions() and main() in chg.c.
    
    In Rust version, we only pass in early arguments to the server as the locator
    doesn't know the full arguments. This should be fine since these arguments
    are just passed in to _earlyparseopts() and _parseconfig(), which means the
    server doesn't need full arguments.
    
    Another difference is the handling of the "exit <code>" instruction. In Rust
    version, we can simply reuse the connection instead of "exit(code)" as the
    command error isn't displayed yet. That's because the client-side stdio is not
    attached until the connection is validated. This behavior is cleaner than C,
    but it also means that the early server exception wouldn't be propagated to
    client because stderr isn't attached. So we might have to reconsider when to
    attach/detach the server stdio.
    
    Differential Revision: https://phab.mercurial-scm.org/D8381
    9ce613d648de